ReactOS 0.4.17-dev-1183-g3b30a2a
CMainWnd Class Reference

#include <CMainWnd.h>

Inheritance diagram for CMainWnd:
Collaboration diagram for CMainWnd:

Public Member Functions

 CMainWnd ()
 
 ~CMainWnd ()
 
LRESULT OnCreate (UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSize (UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnCloseChild (UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnDestroy (UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnClose (UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnNotify (UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnMenuSelect (UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnFileNew (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnFileOpen (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnFileSave (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnFileSaveAs (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnFileAdd (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnFileOptions (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnFileRecent (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnFileExit (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnActionNewWindow (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnActionRename (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnViewMode (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnViewCustomize (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnWindowsNew (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnWindowsCascade (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnWindowsTile (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnWindowsArrange (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnHelpAboutMMC (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnHelpAboutSnapin (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnToolbarSelectParent (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnToolbarScopePane (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnToolbarActionsPane (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
LRESULT OnMDIForward (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
 
CAtlString * GetConsoleTitle ()
 
void SetConsoleTitle (CAtlString consoleTitle)
 
BOOL IsToolBarVisible ()
 
VOID SetToolBarVisible (BOOL bVisible)
 
BOOL AreStandardMenusVisible ()
 
VOID SetStandardMenusVisible (BOOL bVisible)
 
VOID UpdateAboutSnapinMenu (CSnapin *Snapin)
 
VOID UpdateViewMenu (LISTVIEW_MODE ListViewMode)
 
VOID UpdateUpToolButton (BOOL bShow)
 
VOID UpdateToolbuttons (BOOL bTreeViewVisible, BOOL bActionsPaneVisible)
 
VOID UpdateLayout ()
 
VOID UpdateViews ()
 
VOID UpdateMenu ()
 
VOID UpdateTitle ()
 
int GetSnapinCacheCount ()
 
CSnapinCacheEntry * GetSnapinCacheEntry (int nIndex)
 
CSnapinCacheEntry * GetSnapinCacheEntryByGuid (PWSTR pszGuid)
 
HIMAGELIST SnapinImageList ()
 
CSnapin * GetRootSnapin ()
 
VOID RegisterView (CConsoleWnd *pView)
 
VOID UnregisterView (CConsoleWnd *pView)
 
UINT GetNextNodeId ()
 
VOID UpdateNextNodeId (UINT NodeId)
 
DOCUMENT_MODE GetDocumentMode ()
 
void SetDocumentMode (DOCUMENT_MODE DocumentMode)
 
BOOL GetLogicalReadOnly ()
 
void SetLogicalReadOnly (BOOL LogicalReadOnly)
 
BOOL GetPreventViewCustomization ()
 
void SetPreventViewCustomization (BOOL PreventCustomization)
 

Static Public Member Functions

static CWndClassInfo & GetWndClassInfo ()
 
static LPCTSTR GetWndClassName ()
 
static LRESULT CALLBACK XDefFrameProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Public Attributes

CWindow m_MDIClient
 
CAtlString m_Filename
 
CSimpleMap< UINT, CSnapin * > * m_TempNodeMap
 

Private Member Functions

void InitMain ()
 
CConsoleWnd * GetActiveChildInfo ()
 
void CreateNewConsoleTitle (CAtlString &str)
 
BOOL CreateView (CSnapin *RootNode, CSnapin *SelectedNode=NULL)
 
LRESULT LoadSnapinCache ()
 
VOID UpdateRecentFilesMenu ()
 
VOID LoadRecentFiles ()
 
VOID AddToRecentFiles (const CAtlString &FileName)
 
DWORD CreateNewFilename (PWSTR pBuffer, DWORD dwSize, DWORD Number)
 
LRESULT SaveMscFile (const CAtlString &FileName)
 
LRESULT LoadMscFile (const CAtlString &FileName)
 
HRESULT ParseScopeTree (MscFile *mscFile, IXMLDOMElement *pRootElement)
 
HRESULT ParseViewsElement (MscFile *mscFile, IXMLDOMElement *pRootElement)
 

Private Attributes

CWndProcThunk m_FrameThunk
 
int m_ConsoleNumber
 
CAtlString m_ConsoleTitle
 
HMENU m_hMenuConsoleSmall
 
HMENU m_hMenuConsoleLarge
 
DOCUMENT_MODE m_DocumentMode
 
BOOL m_LogicalReadOnly
 
BOOL m_PreventViewCustomization
 
CToolbar< DWORD_PTR > m_ToolBar
 
int m_iToolBarHeight
 
BOOL m_bToolBarVisible
 
HIMAGELIST m_hToolBarImageList
 
BOOL m_bStandardMenusVisible
 
CSimpleArray< CSnapinCacheEntry * > m_SnapinCache
 
HIMAGELIST m_hSnapinImageList
 
CAtlList< CConsoleWnd * > m_ViewList
 
UINT m_NextViewId
 
CSnapin * m_RootNode
 
UINT m_NextNodeId
 
CAtlList< CRecentFileEntry * > m_RecentFilesList
 

Detailed Description

Definition at line 23 of file CMainWnd.h.

Constructor & Destructor Documentation

◆ CMainWnd()

CMainWnd::CMainWnd ( )

Definition at line 26 of file CMainWnd.cpp.

31 , m_bToolBarVisible(true)
32 , m_NextViewId(1)
34 , m_NextNodeId(1)
36{
38 m_pfnSuperWindowProc = m_FrameThunk.GetWNDPROC();
40 m_hMenuConsoleSmall = LoadMenu(_AtlBaseModule.GetModuleInstance(), MAKEINTRESOURCE(IDM_CONSOLE_SMALL));
41 m_hMenuConsoleLarge = LoadMenu(_AtlBaseModule.GetModuleInstance(), MAKEINTRESOURCE(IDM_CONSOLE_LARGE));
45 0,
46 4);
47
51 0,
52 4);
53
54 HBITMAP hToolBarBitmap = LoadBitmapW(_AtlBaseModule.GetModuleInstance(), MAKEINTRESOURCE(IDB_TOOLBAR));
56 hToolBarBitmap,
57 RGB(0,0,0));
58 DeleteObject(hToolBarBitmap);
59
62}
#define IDM_CONSOLE_SMALL
Definition: resource.h:8
#define IDM_CONSOLE_LARGE
Definition: resource.h:9
@ DocumentMode_Author
Definition: precomp.h:43
#define IDB_TOOLBAR
Definition: resource.h:19
WNDPROC GetWNDPROC()
Definition: atlwin.h:258
BOOL Init(WNDPROC proc, void *pThis)
Definition: atlwin.h:250
CWndProcThunk m_FrameThunk
Definition: CMainWnd.h:27
UINT m_NextNodeId
Definition: CMainWnd.h:50
HIMAGELIST m_hToolBarImageList
Definition: CMainWnd.h:40
static LRESULT CALLBACK XDefFrameProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CMainWnd.h:136
int m_ConsoleNumber
Definition: CMainWnd.h:29
VOID LoadRecentFiles()
Definition: CMainWnd.cpp:898
HMENU m_hMenuConsoleSmall
Definition: CMainWnd.h:31
CSnapin * m_RootNode
Definition: CMainWnd.h:49
CSimpleMap< UINT, CSnapin * > * m_TempNodeMap
Definition: CMainWnd.h:59
HIMAGELIST m_hSnapinImageList
Definition: CMainWnd.h:44
LRESULT LoadSnapinCache()
Definition: CMainWnd.cpp:614
DOCUMENT_MODE m_DocumentMode
Definition: CMainWnd.h:33
BOOL m_LogicalReadOnly
Definition: CMainWnd.h:34
BOOL m_PreventViewCustomization
Definition: CMainWnd.h:35
HMENU m_hMenuConsoleLarge
Definition: CMainWnd.h:32
BOOL m_bToolBarVisible
Definition: CMainWnd.h:39
UINT m_NextViewId
Definition: CMainWnd.h:47
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(void *reserved, DWORD model)
Definition: combase.c:2803
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:573
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:814
#define RGB(r, g, b)
Definition: precomp.h:88
pKey DeleteObject()
static HBITMAP
Definition: button.c:44
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:279
#define ILC_COLOR32
Definition: commctrl.h:358
#define ILC_MASK
Definition: commctrl.h:351
#define SM_CYSMICON
Definition: winuser.h:1024
#define SM_CXSMICON
Definition: winuser.h:1023
#define LoadMenu
Definition: winuser.h:5983
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2532
int WINAPI GetSystemMetrics(_In_ int)

◆ ~CMainWnd()

CMainWnd::~CMainWnd ( )

Definition at line 64 of file CMainWnd.cpp.

65{
71}
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:941
BOOL WINAPI DestroyMenu(_In_ HMENU)

Member Function Documentation

◆ AddToRecentFiles()

VOID CMainWnd::AddToRecentFiles ( const CAtlString &  FileName)
private

Definition at line 931 of file CMainWnd.cpp.

932{
933 POSITION pos = m_RecentFilesList.GetHeadPosition();
934 while (pos != NULL)
935 {
937 if (ValueData->FileName() == FileName)
938 break;
939
940 m_RecentFilesList.GetNext(pos);
941 }
942
943 if (pos == NULL)
944 {
945 /* Insert at top */
947 if (m_RecentFilesList.GetCount() > 4)
948 m_RecentFilesList.RemoveTail();
949 }
950 else
951 {
952 /* Move to top */
953 /* m_RecentFilesList.MoveToHead(pos); */
955 m_RecentFilesList.RemoveAt(pos);
957 }
958
959 /* Update the registry key */
960 CRegKey RecentFilesKey;
961 if (ERROR_SUCCESS == RecentFilesKey.Create(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\MMC_NEW\\Recent Files List"))
962 {
963 INT count = 0;
965 pos = m_RecentFilesList.GetHeadPosition();
966 while (pos != NULL)
967 {
969 ValueName.Format(L"File%u", count + 1);
970 RecentFilesKey.SetStringValue(ValueName, ValueData->FileName().GetString());
971 count++;
972 if (count >= MAX_RECENT_FILES)
973 break;
974 }
975
976 RecentFilesKey.Close();
977 }
978
980}
#define MAX_RECENT_FILES
Definition: CMainWnd.h:21
LONG SetStringValue(LPCTSTR pszValueName, LPCTSTR pszValue, DWORD dwType=REG_SZ) noexcept
Definition: atlbase.h:1315
LONG Create(HKEY hKeyParent, LPCTSTR lpszKeyName, LPTSTR lpszClass=REG_NONE, DWORD dwOptions=REG_OPTION_NON_VOLATILE, REGSAM samDesired=KEY_READ|KEY_WRITE, LPSECURITY_ATTRIBUTES lpSecAttr=NULL, LPDWORD lpdwDisposition=NULL) noexcept
Definition: atlbase.h:1189
LONG Close() noexcept
Definition: atlbase.h:1156
CAtlList< CRecentFileEntry * > m_RecentFilesList
Definition: CMainWnd.h:52
VOID UpdateRecentFilesMenu()
Definition: CMainWnd.cpp:860
#define ERROR_SUCCESS
Definition: deptool.c:10
#define L(x)
Definition: resources.c:13
GLuint GLuint GLsizei count
Definition: gl.h:1545
_In_ GUID _In_ PVOID ValueData
Definition: hubbusif.h:312
int32_t INT
Definition: typedefs.h:58
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by OnFileOpen(), OnFileRecent(), and OnFileSaveAs().

◆ AreStandardMenusVisible()

BOOL CMainWnd::AreStandardMenusVisible ( )

Definition at line 600 of file CMainWnd.cpp.

601{
603}
BOOL m_bStandardMenusVisible
Definition: CMainWnd.h:41

Referenced by CCustomizeDialog::OnInitDialog().

◆ CreateNewConsoleTitle()

void CMainWnd::CreateNewConsoleTitle ( CAtlString &  str)
inlineprivate

Definition at line 168 of file CMainWnd.h.

169 {
171 str.LoadString(IDS_CONSOLETITLE);
172
173 LPTSTR lpTarget = NULL;
175 str.GetString(), 0, 0, (LPTSTR)&lpTarget, 0, (va_list*)args);
176
177 if (Ret)
178 {
179 str = lpTarget;
180 LocalFree(lpTarget);
181 }
182 }
#define IDS_CONSOLETITLE
Definition: resource.h:4
char * va_list
Definition: vadefs.h:50
unsigned long DWORD
Definition: ntddk_ex.h:95
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
LPSTR LPTSTR
Definition: ms-dtyp.idl:131
const WCHAR * str
Definition: match.c:390
#define DWORD_PTR
Definition: treelist.c:76
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define FormatMessage
Definition: winbase.h:3518
#define FORMAT_MESSAGE_FROM_STRING
Definition: winbase.h:398
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:396
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
Definition: winbase.h:401

Referenced by UpdateTitle().

◆ CreateNewFilename()

DWORD CMainWnd::CreateNewFilename ( PWSTR  pBuffer,
DWORD  dwSize,
DWORD  Number 
)
private

Definition at line 983 of file CMainWnd.cpp.

984{
985 DWORD_PTR args[1] = { (DWORD_PTR)Number };
987
988 str.LoadString(IDS_CONSOLETITLE);
989
991 str.GetString(), 0, 0, pBuffer, dwSize, (va_list*)args);
992}
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
_In_ ULONG Number
Definition: haltypes.h:1940
PVOID pBuffer

Referenced by OnFileSaveAs().

◆ CreateView()

BOOL CMainWnd::CreateView ( CSnapin *  RootNode,
CSnapin *  SelectedNode = NULL 
)
private

Definition at line 543 of file CMainWnd.cpp.

544{
546 HWND hChild;
547
548 mcs.szTitle = RootNode->DisplayName().GetString();
550 mcs.hOwner = _AtlBaseModule.GetModuleInstance();
551 mcs.x = mcs.cx = CW_USEDEFAULT;
552 mcs.y = mcs.cy = CW_USEDEFAULT;
553 mcs.style = MDIS_ALLCHILDSTYLES;
554 BOOL bMaximized = FALSE;
555 HWND hWndOld = (HWND)m_MDIClient.SendMessage(WM_MDIGETACTIVE, 0, (LPARAM)&bMaximized);
556 mcs.lParam = bMaximized || !hWndOld;
557 /* This object registers itself in the _AtlWinModule to be assigned to the next window created */
558 CConsoleWnd* child = new CConsoleWnd(this, RootNode, SelectedNode);
559 /* Ask for a new MDI Child window */
561 if (!hChild)
562 {
563 delete child;
564 return FALSE;
565 }
566
567 UpdateLayout();
568 UpdateTitle();
569 UpdateMenu();
570 UpdateViewMenu(child->GetListViewMode());
571
572 return TRUE;
573}
static struct myctx * mcs
Definition: adnstest.c:53
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1116
static LPCWSTR GetWndClassName()
Definition: CConsoleWnd.h:99
VOID UpdateLayout()
Definition: CMainWnd.cpp:723
VOID UpdateMenu()
Definition: CMainWnd.cpp:749
VOID UpdateViewMenu(LISTVIEW_MODE ListViewMode)
Definition: CMainWnd.cpp:837
CWindow m_MDIClient
Definition: CMainWnd.h:55
VOID UpdateTitle()
Definition: CMainWnd.cpp:763
#define TRUE
Definition: types.h:120
HANDLE HWND
Definition: compat.h:19
unsigned int BOOL
Definition: ntddk_ex.h:94
PCONFIGURATION_COMPONENT_DATA RootNode
Definition: macharm.c:19
LONG_PTR LPARAM
Definition: minwindef.h:175
static HTREEITEM hChild
Definition: treeview.c:383
static HWND child
Definition: cursoricon.c:298
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WM_MDICREATE
Definition: winuser.h:1840
#define MDIS_ALLCHILDSTYLES
Definition: winuser.h:253
#define CW_USEDEFAULT
Definition: winuser.h:225
#define WM_MDIGETACTIVE
Definition: winuser.h:1849

Referenced by OnFileNew(), and OnWindowsNew().

◆ GetActiveChildInfo()

CConsoleWnd * CMainWnd::GetActiveChildInfo ( )
inlineprivate

Definition at line 157 of file CMainWnd.h.

158 {
159 HWND hWndMDIChild;
160
161 hWndMDIChild = (HWND)m_MDIClient.SendMessage(WM_MDIGETACTIVE, 0, 0);
162 if (hWndMDIChild == NULL)
163 return NULL;
164
165 return (CConsoleWnd*)::GetWindowLongPtr(hWndMDIChild, 0);
166 }
#define GetWindowLongPtr
Definition: treelist.c:73

Referenced by OnActionNewWindow(), OnActionRename(), OnFileAdd(), OnFileOptions(), OnFileSave(), OnFileSaveAs(), OnMenuSelect(), OnToolbarActionsPane(), OnToolbarScopePane(), OnToolbarSelectParent(), OnViewCustomize(), and OnViewMode().

◆ GetConsoleTitle()

CAtlString * CMainWnd::GetConsoleTitle ( )

Definition at line 575 of file CMainWnd.cpp.

576{
577 return &m_ConsoleTitle;
578}
CAtlString m_ConsoleTitle
Definition: CMainWnd.h:30

Referenced by COptionsDialog::OnInitDialog().

◆ GetDocumentMode()

DOCUMENT_MODE CMainWnd::GetDocumentMode ( )

Definition at line 773 of file CMainWnd.cpp.

774{
775 return m_DocumentMode;
776}

Referenced by COptionsDialog::COptionsDialog().

◆ GetLogicalReadOnly()

BOOL CMainWnd::GetLogicalReadOnly ( )

Definition at line 785 of file CMainWnd.cpp.

786{
787 return m_LogicalReadOnly;
788}

Referenced by COptionsDialog::COptionsDialog().

◆ GetNextNodeId()

UINT CMainWnd::GetNextNodeId ( )

Definition at line 695 of file CMainWnd.cpp.

696{
697 return m_NextNodeId++;
698}

Referenced by CAddDialog::OnCommand(), and CAddDialog::OnItemDblClicked().

◆ GetPreventViewCustomization()

BOOL CMainWnd::GetPreventViewCustomization ( )

Definition at line 797 of file CMainWnd.cpp.

798{
800}

Referenced by COptionsDialog::COptionsDialog().

◆ GetRootSnapin()

CSnapin * CMainWnd::GetRootSnapin ( )

Definition at line 668 of file CMainWnd.cpp.

669{
670 return m_RootNode;
671}

Referenced by CAddDialog::OnInitDialog(), and CConsoleWnd::OnNotify().

◆ GetSnapinCacheCount()

int CMainWnd::GetSnapinCacheCount ( )

Definition at line 638 of file CMainWnd.cpp.

639{
640 return m_SnapinCache.GetSize();
641}
CSimpleArray< CSnapinCacheEntry * > m_SnapinCache
Definition: CMainWnd.h:43

Referenced by CAddDialog::OnInitDialog(), and SaveMscFile().

◆ GetSnapinCacheEntry()

CSnapinCacheEntry * CMainWnd::GetSnapinCacheEntry ( int  nIndex)

Definition at line 644 of file CMainWnd.cpp.

645{
646 return m_SnapinCache[nIndex];
647}

Referenced by CAddDialog::OnInitDialog(), and SaveMscFile().

◆ GetSnapinCacheEntryByGuid()

CSnapinCacheEntry * CMainWnd::GetSnapinCacheEntryByGuid ( PWSTR  pszGuid)

Definition at line 650 of file CMainWnd.cpp.

651{
652 for (int i = 0; i < m_SnapinCache.GetSize(); i++)
653 {
655 if (entry->GuidString().CompareNoCase(pszGuid) == 0)
656 return entry;
657 }
658 return NULL;
659}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
uint32_t entry
Definition: isohybrid.c:63

Referenced by OnFileNew(), and CSnapin::ParseSnapin().

◆ GetWndClassInfo()

static CWndClassInfo & CMainWnd::GetWndClassInfo ( )
inlinestatic

Definition at line 108 of file CMainWnd.h.

109 {
110 static CWndClassInfo wc =
111 {
112 {
113 /* cbSize= */sizeof(WNDCLASSEX),
114 /* style= */0,
115 /* lpfnWndProc= */StartWindowProc,
116 /* cbClsExtra= */0,
117 /* cbWndExtra= */0,
118 /* hInstance= */NULL,
119 /* hIcon= */LoadIcon(_AtlBaseModule.GetModuleInstance(), MAKEINTRESOURCE(IDI_MAINAPP)),
120 /* hCursor= */NULL,
121 /* hbrBackground= */(HBRUSH)(COLOR_BTNFACE + 1),
122 /* lpszMenuName= */NULL,
123 /* lpszClassName= */TEXT("MMCMainFrame"),
124 /* hIconSm= */LoadIcon(_AtlBaseModule.GetModuleInstance(), MAKEINTRESOURCE(IDI_MAINAPP))
125 },
126 NULL, NULL, IDC_ARROW, TRUE, 0, L""
127 };
128 return wc;
129 }
#define IDI_MAINAPP
Definition: resource.h:6
#define TEXT(s)
Definition: k32.h:28
_ATL_WNDCLASSINFOW CWndClassInfo
Definition: atlwin.h:70
#define IDC_ARROW
Definition: winuser.h:695
#define LoadIcon
Definition: winuser.h:5979
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5885
#define COLOR_BTNFACE
Definition: winuser.h:939

Referenced by GetWndClassName().

◆ GetWndClassName()

static LPCTSTR CMainWnd::GetWndClassName ( )
inlinestatic

Definition at line 131 of file CMainWnd.h.

132 {
133 return GetWndClassInfo().m_wc.lpszClassName;
134 }
static CWndClassInfo & GetWndClassInfo()
Definition: CMainWnd.h:108

◆ InitMain()

void CMainWnd::InitMain ( )
inlineprivate

Definition at line 144 of file CMainWnd.h.

Referenced by OnFileNew(), OnFileOpen(), and OnFileRecent().

◆ IsToolBarVisible()

BOOL CMainWnd::IsToolBarVisible ( )

Definition at line 587 of file CMainWnd.cpp.

588{
589 return m_bToolBarVisible;
590}

Referenced by CCustomizeDialog::OnInitDialog().

◆ LoadMscFile()

LRESULT CMainWnd::LoadMscFile ( const CAtlString &  FileName)
private

Definition at line 1093 of file CMainWnd.cpp.

1094{
1095 IXMLDOMElement *pRootElement = NULL;
1096 IXMLDOMElement *pFrameStateElement = NULL;
1097 VARIANT ProgramMode;
1098 HRESULT hr = S_OK;
1099
1101
1102 VariantInit(&ProgramMode);
1103
1107
1108 MscFile *mscFile = new MscFile(FileName.GetString());
1109
1110 hr = mscFile->CreateAndInitDOM();
1111 if (FAILED(hr))
1112 goto done;
1113
1114 hr = mscFile->LoadDOM();
1115 if (FAILED(hr))
1116 goto done;
1117
1118 hr = mscFile->CheckMscFile(&pRootElement);
1119 if (hr != S_OK)
1120 goto done;
1121
1122 hr = mscFile->GetAttribute(pRootElement, (LPWSTR)L"ProgramMode", &ProgramMode);
1123 if (hr != S_OK)
1124 goto done;
1125
1127 if (hr != S_OK)
1128 goto done;
1129
1130 hr = mscFile->GetElement(pRootElement, (LPWSTR)L"FrameState", &pFrameStateElement);
1131 if (hr != S_OK)
1132 goto done;
1133
1135 {
1136 VARIANT LogicalReadOnly, PreventViewCustomization;
1137
1138 VariantInit(&LogicalReadOnly);
1139 VariantInit(&PreventViewCustomization);
1140
1141 hr = mscFile->GetAttribute(pFrameStateElement, (LPWSTR)L"LogicalReadOnly", &LogicalReadOnly);
1142 if ((hr == S_OK) && (_wcsicmp(V_BSTR(&LogicalReadOnly), L"true") == 0))
1144
1145 hr = mscFile->GetAttribute(pFrameStateElement, (LPWSTR)L"PreventViewCustomization", &PreventViewCustomization);
1146 if ((hr == S_OK) && (_wcsicmp(V_BSTR(&PreventViewCustomization), L"true") == 0))
1148
1149 VariantClear(&LogicalReadOnly);
1150 VariantClear(&PreventViewCustomization);
1151 hr = S_OK;
1152 }
1153
1154 hr = mscFile->ParseWindowPlacement(this, pFrameStateElement);
1155 if (hr != S_OK)
1156 goto done;
1157
1158 /* FIXME Parse other frame settings */
1159
1160 /* Parse the ScopeTree element */
1161 hr = ParseScopeTree(mscFile, pRootElement);
1162 if (hr != S_OK)
1163 goto done;
1164
1165 /* Parse the Views element */
1166 hr = ParseViewsElement(mscFile, pRootElement);
1167 if (hr != S_OK)
1168 goto done;
1169
1170done:
1171 VariantClear(&ProgramMode);
1172
1173 if (pFrameStateElement)
1174 pFrameStateElement->Release();
1175
1176 if (pRootElement)
1177 pRootElement->Release();
1178
1179 delete m_TempNodeMap;
1181
1182 delete mscFile;
1183
1184 if (hr == S_FALSE)
1185 {
1186// ::MessageBox(NULL, L"Invalid file!", FileName.GetString(), MB_OK);
1187 }
1188 else if (hr != S_OK)
1189 {
1190// ::MessageBox(NULL, L"Failure!", FileName.GetString(), MB_OK);
1191 }
1192
1193 return ERROR_SUCCESS;
1194}
HRESULT StringToDocumentMode(_In_ LPWSTR pszDocumentMode, _Out_ PDOCUMENT_MODE pDocumentMode)
Definition: misc.cpp:228
HRESULT ParseViewsElement(MscFile *mscFile, IXMLDOMElement *pRootElement)
Definition: CMainWnd.cpp:1235
HRESULT ParseScopeTree(MscFile *mscFile, IXMLDOMElement *pRootElement)
Definition: CMainWnd.cpp:1197
HRESULT CreateAndInitDOM()
Definition: mscfile.cpp:46
HRESULT GetElement(IXMLDOMElement *pParentElement, LPWSTR pszElementName, IXMLDOMElement **ppElement)
Definition: mscfile.cpp:509
HRESULT ParseWindowPlacement(CWindow *pWindow, IXMLDOMElement *pParentElement)
Definition: mscfile.cpp:272
HRESULT LoadDOM()
Definition: mscfile.cpp:398
HRESULT GetAttribute(IXMLDOMElement *pElement, LPWSTR pszAttributeName, VARIANT *pAttributeValue)
Definition: mscfile.cpp:484
HRESULT CheckMscFile(IXMLDOMElement **ppRootElement)
Definition: mscfile.cpp:427
HRESULT hr
Definition: delayimp.cpp:582
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
ULONG Release()
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define V_BSTR(A)
Definition: oleauto.h:226
uint16_t * LPWSTR
Definition: typedefs.h:56
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:626
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:547
#define S_FALSE
Definition: winerror.h:3451

Referenced by OnFileOpen(), and OnFileRecent().

◆ LoadRecentFiles()

VOID CMainWnd::LoadRecentFiles ( )
private

Definition at line 898 of file CMainWnd.cpp.

899{
900 CRegKey RecentFilesKey;
901 if (ERROR_SUCCESS == RecentFilesKey.Open(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\MMC_NEW\\Recent Files List", KEY_READ))
902 {
903 WCHAR pathBuf[MAX_PATH];
904 ULONG pathLength, i;
905 DWORD err;
906
907 CAtlString valueName;
908 CAtlString fileName;
909
910 for (i = 0; i < MAX_RECENT_FILES; i++)
911 {
912 valueName.Format(L"File%u", i + 1);
913 pathLength = _countof(pathBuf);
914 err = RecentFilesKey.QueryStringValue(valueName.GetString(),
915 pathBuf,
916 &pathLength);
917 if (err == ERROR_SUCCESS)
918 {
919 CAtlString fileName(pathBuf);
920 m_RecentFilesList.AddTail(new CRecentFileEntry(fileName));
921 }
922 }
923
924 RecentFilesKey.Close();
925 }
926
928}
LONG Open(HKEY hKeyParent, LPCTSTR lpszKeyName, REGSAM samDesired=KEY_READ|KEY_WRITE) noexcept
Definition: atlbase.h:1173
LONG QueryStringValue(LPCTSTR pszValueName, LPTSTR pszValue, ULONG *pnChars) noexcept
Definition: atlbase.h:1240
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:818
#define MAX_PATH
Definition: compat.h:34
#define KEY_READ
Definition: nt_native.h:1026
short WCHAR
Definition: pedump.c:58
#define err(...)
#define _countof(array)
Definition: sndvol32.h:70
uint32_t ULONG
Definition: typedefs.h:59

Referenced by CMainWnd().

◆ LoadSnapinCache()

LRESULT CMainWnd::LoadSnapinCache ( )
private

Definition at line 614 of file CMainWnd.cpp.

615{
616 CRegKey SnapinsKey;
617 if (ERROR_SUCCESS == SnapinsKey.Open(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\MMC\\SnapIns", KEY_READ))
618 {
619 WCHAR namebuf[MAX_PATH];
620 DWORD index = 0, namelen = _countof(namebuf);
621 while (ERROR_SUCCESS == SnapinsKey.EnumKey(index++, namebuf, &namelen))
622 {
623 DPRINT1("%S\n", namebuf);
624 CSnapinCacheEntry* snapin = CSnapinCacheEntry::Create(SnapinsKey, namebuf, m_hSnapinImageList);
625 DPRINT1("CacheEntry %p\n", snapin);
626 if (snapin)
627 {
628 m_SnapinCache.Add(snapin);
629 }
630 namelen = _countof(namebuf);
631 }
632 SnapinsKey.Close();
633 }
634 return S_OK;
635}
#define DPRINT1
Definition: precomp.h:8
LONG EnumKey(DWORD iIndex, LPTSTR pszName, LPDWORD pnNameLength, FILETIME *pftLastWriteTime=NULL) noexcept
Definition: atlbase.h:1421
static CSnapinCacheEntry * Create(CRegKey &SnapinsKey, PWSTR guidString, HIMAGELIST hImageList)
GLint namelen
Definition: glext.h:7232
GLuint index
Definition: glext.h:6031
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by CMainWnd().

◆ OnActionNewWindow()

LRESULT CMainWnd::OnActionNewWindow ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 381 of file CMainWnd.cpp.

382{
384 if (child == NULL)
385 return 0;
386
387 child->OnActionNewWindow(wNotifyCode, wID, hWndCtl, bHandled);
388
389 return 0;
390}
CConsoleWnd * GetActiveChildInfo()
Definition: CMainWnd.h:157

◆ OnActionRename()

LRESULT CMainWnd::OnActionRename ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 393 of file CMainWnd.cpp.

394{
396 if (child == NULL)
397 return 0;
398
399 child->OnActionRename(wNotifyCode, wID, hWndCtl, bHandled);
400
401 return 0;
402}

◆ OnClose()

LRESULT CMainWnd::OnClose ( UINT  nMessage,
WPARAM  wParam,
LPARAM  lParam,
BOOL &  bHandled 
)

Definition at line 140 of file CMainWnd.cpp.

141{
143 return 0;
144}
BOOL WINAPI DestroyWindow(_In_ HWND)

◆ OnCloseChild()

LRESULT CMainWnd::OnCloseChild ( UINT  nMessage,
WPARAM  wParam,
LPARAM  lParam,
BOOL &  bHandled 
)

Definition at line 123 of file CMainWnd.cpp.

124{
125 UpdateLayout();
126 UpdateTitle();
127 UpdateMenu();
128 return 0;
129}

◆ OnCreate()

LRESULT CMainWnd::OnCreate ( UINT  nMessage,
WPARAM  wParam,
LPARAM  lParam,
BOOL &  bHandled 
)

Definition at line 74 of file CMainWnd.cpp.

75{
77 LPCTSTR lpFileName = (LPCTSTR)(((LPCREATESTRUCT)lParam)->lpCreateParams);
78 RECT rect;
79
81
82 /* Create and initialize the Toolbar */
84 m_ToolBar.Create(m_hWnd,
86 0);
87
88 m_ToolBar.SendMessageW(TB_SETBITMAPSIZE, 0, MAKELONG(16, 16));
89 m_ToolBar.SendMessageW(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
90
93
94 m_ToolBar.GetClientRect(&rect);
96
99
100 /* Create the MDI client window */
103
107
108 if (lpFileName == NULL)
109 {
111 }
112 return 0;
113}
static TBBUTTON TbButtons[]
Definition: CMainWnd.cpp:12
#define IDM_FILE_NEW
Definition: resource.h:11
#define IDM_MDI_FIRSTCHILD
Definition: resource.h:19
#define U(x)
Definition: wordpad.c:45
HWND Create(LPCTSTR lpstrWndClass, HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: atlwin.h:417
BOOL UpdateWindow()
Definition: atlwin.h:1345
BOOL ShowWindow(int nCmdShow)
Definition: atlwin.h:1333
CToolbar< DWORD_PTR > m_ToolBar
Definition: CMainWnd.h:37
int m_iToolBarHeight
Definition: CMainWnd.h:38
HWND Create(HWND hWndParent, DWORD dwStyles=0, DWORD dwExStyles=0)
Definition: rosctrls.h:256
HIMAGELIST SetImageList(HIMAGELIST himl)
Definition: rosctrls.h:429
RECT rect
Definition: combotst.c:67
LPARAM lParam
Definition: combotst.c:139
LPCSTR LPCTSTR
Definition: ms-dtyp.idl:130
#define WS_CHILD
Definition: pedump.c:617
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_HSCROLL
Definition: pedump.c:628
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:989
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1134
#define TB_SETBITMAPSIZE
Definition: commctrl.h:1136
#define TBSTYLE_FLAT
Definition: commctrl.h:992
#define TB_ADDBUTTONSW
Definition: commctrl.h:1266
#define WM_COMMAND
Definition: winuser.h:1768
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define PostMessage
Definition: winuser.h:5998
#define SW_SHOW
Definition: winuser.h:786
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
#define MAKELONG(a, b)
Definition: typedefs.h:249
_In_ LPCSTR lpFileName
Definition: winbase.h:2800

◆ OnDestroy()

LRESULT CMainWnd::OnDestroy ( UINT  nMessage,
WPARAM  wParam,
LPARAM  lParam,
BOOL &  bHandled 
)

Definition at line 132 of file CMainWnd.cpp.

133{
135 SetMenu(NULL);
136 return 0;
137}
BOOL WINAPI SetMenu(_In_ HWND, _In_opt_ HMENU)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

◆ OnFileAdd()

LRESULT CMainWnd::OnFileAdd ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 316 of file CMainWnd.cpp.

317{
319 if (child == NULL)
320 return 0;
321 CAddDialog dlg(this, child);
322 if (dlg.DoModal(m_hWnd, (LPARAM)child) == IDOK)
323 {
324 UpdateViews();
325 }
326
327 return 0;
328}
VOID UpdateViews()
Definition: CMainWnd.cpp:708
#define IDOK
Definition: winuser.h:841

◆ OnFileExit()

LRESULT CMainWnd::OnFileExit ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 374 of file CMainWnd.cpp.

375{
376 PostMessage(WM_CLOSE, 0, 0);
377 return 0;
378}
#define WM_CLOSE
Definition: winuser.h:1649

◆ OnFileNew()

LRESULT CMainWnd::OnFileNew ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 181 of file CMainWnd.cpp.

182{
184// CAtlString nodeGuid(L"{C96401CC-0E17-11D3-885B-00C04F72C717}");
185
186 /* Close all views */
187 POSITION pos = m_ViewList.GetHeadPosition();
188 while (pos)
189 {
190 CConsoleWnd *console = (CConsoleWnd*)m_ViewList.GetNext(pos);
191 console->SendMessage(WM_CLOSE, 0, 0);
192 }
193
194 InitMain();
195
196 /* Create a new snapin root node */
197 CSnapinCacheEntry *CacheEntry = GetSnapinCacheEntryByGuid((PWSTR)L"{C96401CC-0E17-11D3-885B-00C04F72C717}");
198 if (!CacheEntry)
199 {
200 DPRINT1("No folder cache entry!\n");
201 return 0;
202 }
203
204 m_RootNode = new CSnapin(CacheEntry, m_NextNodeId++, rootName.GetString());
205 if (!CacheEntry)
206 {
207 DPRINT1("No root folder!\n");
208 return 0;
209 }
210
213
214 return 1;
215}
#define IDS_CONSOLEROOT
Definition: resource.h:113
BOOL CreateView(CSnapin *RootNode, CSnapin *SelectedNode=NULL)
Definition: CMainWnd.cpp:543
CAtlList< CConsoleWnd * > m_ViewList
Definition: CMainWnd.h:46
void InitMain()
Definition: CMainWnd.h:144
CSnapinCacheEntry * GetSnapinCacheEntryByGuid(PWSTR pszGuid)
Definition: CMainWnd.cpp:650
uint16_t * PWSTR
Definition: typedefs.h:56

◆ OnFileOpen()

LRESULT CMainWnd::OnFileOpen ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 218 of file CMainWnd.cpp.

219{
220 OPENFILENAME openas;
222
223 ZeroMemory(&openas, sizeof(openas));
224 wcscpy(szPath, L"");
225
226 openas.lStructSize = sizeof(OPENFILENAME);
227 openas.hwndOwner = m_hWnd;
228 openas.hInstance = _AtlBaseModule.GetModuleInstance();
229 openas.lpstrFilter = L"MSC Files (*.msc)\0*.msc\0All Files (*.*)\0*.*\0";
230 openas.lpstrFile = szPath;
231 openas.nMaxFile = MAX_PATH;
233 openas.lpstrDefExt = L"msc";
234
235 if (GetOpenFileNameW(&openas))
236 {
237 /* Close all views */
238 POSITION pos = m_ViewList.GetHeadPosition();
239 while (pos)
240 {
241 CConsoleWnd *console = (CConsoleWnd*)m_ViewList.GetNext(pos);
242 console->SendMessage(WM_CLOSE, 0, 0);
243 }
244
245 InitMain();
246
249 if (ret == ERROR_SUCCESS)
250 {
253 }
254 }
255
256 return 0;
257}
VOID AddToRecentFiles(const CAtlString &FileName)
Definition: CMainWnd.cpp:931
LRESULT LoadMscFile(const CAtlString &FileName)
Definition: CMainWnd.cpp:1093
CAtlString m_Filename
Definition: CMainWnd.h:56
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
OPENFILENAMEA OPENFILENAME
Definition: commdlg.h:657
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4760
return ret
Definition: mutex.c:147
#define ZeroMemory
Definition: minwinbase.h:31
LONG_PTR LRESULT
Definition: minwindef.h:176
LPCWSTR szPath
Definition: env.c:37
wcscpy
LPCSTR lpstrDefExt
Definition: commdlg.h:345
HWND hwndOwner
Definition: commdlg.h:330
HINSTANCE hInstance
Definition: commdlg.h:331
LPSTR lpstrFile
Definition: commdlg.h:336
DWORD Flags
Definition: commdlg.h:342
DWORD lStructSize
Definition: commdlg.h:329
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD nMaxFile
Definition: commdlg.h:337

◆ OnFileOptions()

LRESULT CMainWnd::OnFileOptions ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 331 of file CMainWnd.cpp.

332{
334 if (child == NULL)
335 return 0;
336 COptionsDialog dlg(this, child);
337 dlg.DoModal(m_hWnd, (LPARAM)child);
338 return 0;
339}

◆ OnFileRecent()

LRESULT CMainWnd::OnFileRecent ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 342 of file CMainWnd.cpp.

343{
345
346 mi.cbSize = sizeof(MENUITEMINFOW);
347 mi.fMask = MIIM_DATA;
348 if (GetMenuItemInfoW(GetMenu(), wID, FALSE, &mi))
349 {
350 CRecentFileEntry *FileEntry = (CRecentFileEntry *)mi.dwItemData;
351
352 /* Close all views */
353 POSITION pos = m_ViewList.GetHeadPosition();
354 while (pos)
355 {
356 CConsoleWnd *console = (CConsoleWnd*)m_ViewList.GetNext(pos);
357 console->SendMessage(WM_CLOSE, 0, 0);
358 }
359
360 InitMain();
361
362 LRESULT ret = LoadMscFile(FileEntry->FileName());
363 if (ret == ERROR_SUCCESS)
364 {
365 AddToRecentFiles(FileEntry->FileName());
367 }
368 }
369
370 return 0;
371}
const CAtlString & FileName() const
static MONITORINFO mi
Definition: win.c:9400
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define MIIM_DATA
Definition: winuser.h:737
HMENU WINAPI GetMenu(_In_ HWND)
struct tagMENUITEMINFOW MENUITEMINFOW
DWORD cbSize
Definition: winuser.h:3892

◆ OnFileSave()

LRESULT CMainWnd::OnFileSave ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 260 of file CMainWnd.cpp.

261{
263 if (child == NULL)
264 return 0;
265
266 if (m_Filename.IsEmpty())
267 return OnFileSaveAs(wNotifyCode, wID, hWndCtl, bHandled);
268
269 return SaveMscFile(m_Filename);
270}
bool IsEmpty() const noexcept
Definition: atlsimpstr.h:394
LRESULT OnFileSaveAs(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Definition: CMainWnd.cpp:273
LRESULT SaveMscFile(const CAtlString &FileName)
Definition: CMainWnd.cpp:995

◆ OnFileSaveAs()

LRESULT CMainWnd::OnFileSaveAs ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 273 of file CMainWnd.cpp.

274{
275 OPENFILENAME saveas;
277
279 if (child == NULL)
280 return 0;
281
282 ZeroMemory(&saveas, sizeof(saveas));
283 if (!m_Filename.IsEmpty())
284 {
286 }
287 else
288 {
289 child->GetWindowText(szPath, MAX_PATH);
291 wcscat(szPath, L".msc");
292 }
293
294 saveas.lStructSize = sizeof(OPENFILENAME);
295 saveas.hwndOwner = m_hWnd;
296 saveas.hInstance = _AtlBaseModule.GetModuleInstance();
297 saveas.lpstrFilter = L"MSC Files (*.msc)\0*.msc\0All Files (*.*)\0*.*\0";
298 saveas.lpstrFile = szPath;
299 saveas.nMaxFile = MAX_PATH;
301 saveas.lpstrDefExt = L"msc";
302
303 if (GetSaveFileNameW(&saveas))
304 {
307 if (ret == ERROR_SUCCESS)
309 return ret;
310 }
311
312 return 0;
313}
DWORD CreateNewFilename(PWSTR pBuffer, DWORD dwSize, DWORD Number)
Definition: CMainWnd.cpp:983
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
BOOL WINAPI GetSaveFileNameW(LPOPENFILENAMEW ofn)
Definition: filedlg.c:4825
wcscat

Referenced by OnFileSave().

◆ OnHelpAboutMMC()

LRESULT CMainWnd::OnHelpAboutMMC ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 462 of file CMainWnd.cpp.

463{
464 HICON hIcon = LoadIcon(_AtlBaseModule.GetModuleInstance(), MAKEINTRESOURCE(IDI_MAINAPP));
467 CAtlString TitleString;
468
469 TitleString = AboutTitle;
470 TitleString += L"#";
471 TitleString += AppTitle;
472
473 ::ShellAboutW(this->m_hWnd, (LPWSTR)TitleString.GetString(), NULL, hIcon);
474
475 return 0;
476}
#define IDS_APPTITLE
Definition: resource.h:3
#define IDS_ABOUTTITLE
Definition: resource.h:15
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
BOOL WINAPI ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)

◆ OnHelpAboutSnapin()

LRESULT CMainWnd::OnHelpAboutSnapin ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 479 of file CMainWnd.cpp.

480{
482
483 mi.cbSize = sizeof(MENUITEMINFOW);
484 mi.fMask = MIIM_DATA;
485 if (GetMenuItemInfoW(GetMenu(), wID, FALSE, &mi))
486 {
487 CSnapin *Snapin = (CSnapin *)mi.dwItemData;
488
489 CAboutSnapinDialog dlg(this, Snapin);
490 dlg.DoModal(m_hWnd, (LPARAM)0);
491 }
492
493 return 0;
494}

◆ OnMDIForward()

LRESULT CMainWnd::OnMDIForward ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 530 of file CMainWnd.cpp.

531{
533 if (hChild)
534 {
535 WPARAM wParam = MAKEWPARAM(wNotifyCode, wID);
536 LPARAM lParam = (LPARAM)hWndCtl;
538 }
539 return 0;
540}
WPARAM wParam
Definition: combotst.c:138
UINT_PTR WPARAM
Definition: minwindef.h:174
#define MAKEWPARAM(l, h)
Definition: winuser.h:4117
#define SendMessage
Definition: winuser.h:6009

◆ OnMenuSelect()

LRESULT CMainWnd::OnMenuSelect ( UINT  nMessage,
WPARAM  wParam,
LPARAM  lParam,
BOOL &  bHandled 
)

Definition at line 166 of file CMainWnd.cpp.

167{
169 if (child == NULL)
170 return 0;
171
172 UINT menuItem = LOWORD(wParam);
173// UINT flags = HIWORD(wParam);
174// HMENU hMenu = (HMENU)lParam;
175 CAtlString menuText(MAKEINTRESOURCE(menuItem));
176 child->SetStatusBarText(menuText.GetString());
177 return 0;
178}
unsigned int UINT
Definition: sysinfo.c:13
#define LOWORD(l)
Definition: pedump.c:82

◆ OnNotify()

LRESULT CMainWnd::OnNotify ( UINT  nMessage,
WPARAM  wParam,
LPARAM  lParam,
BOOL &  bHandled 
)

Definition at line 147 of file CMainWnd.cpp.

148{
149 NMHDR *phdr = (NMHDR *)lParam;
150 switch (phdr->code)
151 {
152 case TBN_GETINFOTIP:
153 {
155
156 CAtlString toolTipText(MAKEINTRESOURCE(lptbgit->iItem));
157 wcscpy(lptbgit->pszText, toolTipText.GetString());
158 }
159 break;
160 }
161
162 return 0;
163}
#define TBN_GETINFOTIP
Definition: commctrl.h:1392
#define LPNMTBGETINFOTIP
Definition: commctrl.h:1394
UINT code
Definition: winuser.h:3267

◆ OnSize()

LRESULT CMainWnd::OnSize ( UINT  nMessage,
WPARAM  wParam,
LPARAM  lParam,
BOOL &  bHandled 
)

Definition at line 116 of file CMainWnd.cpp.

117{
118 UpdateLayout();
119 return 0;
120}

◆ OnToolbarActionsPane()

LRESULT CMainWnd::OnToolbarActionsPane ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 519 of file CMainWnd.cpp.

520{
522 if (child == NULL)
523 return 0;
524
525 child->SetActionsPaneVisible(!child->IsActionsPaneVisible());
526 return 0;
527}

◆ OnToolbarScopePane()

LRESULT CMainWnd::OnToolbarScopePane ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 508 of file CMainWnd.cpp.

509{
511 if (child == NULL)
512 return 0;
513
514 child->SetTreeViewVisible(!child->IsTreeViewVisible());
515 return 0;
516}

◆ OnToolbarSelectParent()

LRESULT CMainWnd::OnToolbarSelectParent ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 497 of file CMainWnd.cpp.

498{
500 if (child == NULL)
501 return 0;
502
503 child->SelectParent();
504 return 0;
505}

◆ OnViewCustomize()

LRESULT CMainWnd::OnViewCustomize ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 422 of file CMainWnd.cpp.

423{
425 if (child == NULL)
426 return 0;
427
428 CCustomizeDialog dlg2(this, child);
429 dlg2.DoModal(m_hWnd, (LPARAM)child);
430 return 0;
431}

Referenced by CConsoleWnd::OnViewCustomize().

◆ OnViewMode()

LRESULT CMainWnd::OnViewMode ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 405 of file CMainWnd.cpp.

406{
408 if (child == NULL)
409 return 0;
410
411 child->SetListViewMode(CmdIdToViewMode(wID));
415 wID,
417
418 return 0;
419}
LISTVIEW_MODE CmdIdToViewMode(UINT CmdId)
Definition: misc.cpp:39
#define IDM_VIEW_LARGE_ICONS
Definition: resource.h:45
#define IDM_VIEW_DETAILS
Definition: resource.h:48
#define MF_BYCOMMAND
Definition: winuser.h:202
BOOL WINAPI CheckMenuRadioItem(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT, _In_ UINT)

Referenced by CConsoleWnd::OnViewMode().

◆ OnWindowsArrange()

LRESULT CMainWnd::OnWindowsArrange ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 455 of file CMainWnd.cpp.

456{
458 return 0;
459}
#define WM_MDIICONARRANGE
Definition: winuser.h:1848

◆ OnWindowsCascade()

LRESULT CMainWnd::OnWindowsCascade ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 441 of file CMainWnd.cpp.

442{
444 return 0;
445}
#define WM_MDICASCADE
Definition: winuser.h:1847

◆ OnWindowsNew()

LRESULT CMainWnd::OnWindowsNew ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 434 of file CMainWnd.cpp.

435{
437 return 0;
438}

◆ OnWindowsTile()

LRESULT CMainWnd::OnWindowsTile ( WORD  wNotifyCode,
WORD  wID,
HWND  hWndCtl,
BOOL &  bHandled 
)

Definition at line 448 of file CMainWnd.cpp.

449{
451 return 0;
452}
#define WM_MDITILE
Definition: winuser.h:1846
#define MDITILE_HORIZONTAL
Definition: winuser.h:2224

◆ ParseScopeTree()

HRESULT CMainWnd::ParseScopeTree ( MscFile *  mscFile,
IXMLDOMElement *  pRootElement 
)
private

Definition at line 1197 of file CMainWnd.cpp.

1198{
1199 IXMLDOMElement *pScopeTreeElement = NULL;
1200 IXMLDOMElement *pNodesElement = NULL;
1201 IXMLDOMElement *pNodeElement = NULL;
1202 HRESULT hr = S_OK;
1203
1204 hr = mscFile->GetElement(pRootElement, (LPWSTR)L"ScopeTree", &pScopeTreeElement);
1205 if (hr != S_OK)
1206 goto done;
1207
1208 /* Fixme: SnapinCache Element */
1209
1210 /* Nodes Element */
1211 hr = mscFile->GetElement(pScopeTreeElement, (LPWSTR)L"Nodes", &pNodesElement);
1212 if (hr != S_OK)
1213 goto done;
1214
1215 hr = mscFile->GetElement(pNodesElement, (LPWSTR)L"Node", &pNodeElement);
1216 if (hr != S_OK)
1217 goto done;
1218
1219 hr = CSnapin::ParseSnapin(this, mscFile, pNodeElement, &m_RootNode);
1220
1221done:
1222 if (pNodeElement)
1223 pNodeElement->Release();
1224
1225 if (pNodesElement)
1226 pNodesElement->Release();
1227
1228 if (pScopeTreeElement)
1229 pScopeTreeElement->Release();
1230
1231 return hr;
1232}
static HRESULT ParseSnapin(CMainWnd *pMainWnd, MscFile *mscFile, IXMLDOMElement *pSnapinNode, CSnapin **ppSnapin)
Definition: CSnapin.cpp:188

Referenced by LoadMscFile().

◆ ParseViewsElement()

HRESULT CMainWnd::ParseViewsElement ( MscFile *  mscFile,
IXMLDOMElement *  pRootElement 
)
private

Definition at line 1235 of file CMainWnd.cpp.

1236{
1237 IXMLDOMElement *pViewsElement = NULL;
1238 IXMLDOMNodeList *pChildList = NULL;
1239 IXMLDOMNode *nextItem;
1241 BSTR NodeName = NULL;
1242 HRESULT hr = S_OK;
1243
1244 hr = mscFile->GetElement(pRootElement, (LPWSTR)L"Views", &pViewsElement);
1245 if (hr != S_OK)
1246 goto done;
1247
1248 hr = pViewsElement->get_childNodes(&pChildList);
1249 if (FAILED(hr))
1250 goto done;
1251
1252 for (;;)
1253 {
1254 hr = pChildList->nextNode(&nextItem);
1255 if (hr == S_FALSE)
1256 {
1257 hr = S_OK;
1258 break;
1259 }
1260
1261 hr = nextItem->get_nodeType(&NodeType);
1262 if (hr == S_OK)
1263 {
1264 if (NodeType == NODE_ELEMENT)
1265 {
1266 NodeName = NULL;
1267 hr = nextItem->get_baseName(&NodeName);
1268 if (hr == S_OK)
1269 {
1270 if (_wcsicmp(NodeName, L"View") == 0)
1271 {
1272 CConsoleWnd::ParseView(this, mscFile, (IXMLDOMElement *)nextItem);
1273 }
1274 SysFreeString(NodeName);
1275 NodeName = NULL;
1276 }
1277 }
1278 }
1279
1280 nextItem->Release();
1281 }
1282
1283done:
1284 if (pChildList)
1285 pChildList->Release();
1286
1287 if (NodeName)
1288 SysFreeString(NodeName);
1289
1290 if (pViewsElement)
1291 pViewsElement->Release();
1292
1293 return hr;
1294}
NodeType
Definition: Node.h:6
static HRESULT ParseView(CMainWnd *pMainWnd, MscFile *mscFile, IXMLDOMElement *pViewElement)
OLECHAR * BSTR
Definition: compat.h:2293
#define NodeType(P)
Definition: nodetype.h:51
HRESULT nextNode([retval, out] IXMLDOMNode **outNode)
enum tagDOMNodeType DOMNodeType
@ NODE_ELEMENT
Definition: msxml6.idl:113
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:273

Referenced by LoadMscFile().

◆ RegisterView()

VOID CMainWnd::RegisterView ( CConsoleWnd *  pView)

Definition at line 674 of file CMainWnd.cpp.

675{
676 m_ViewList.AddTail(pView);
677 if (pView->m_ViewId == 0)
678 pView->m_ViewId = m_NextViewId++;
679 else if (m_NextViewId <= pView->m_ViewId)
680 m_NextViewId = pView->m_ViewId + 1;
681}
UINT m_ViewId
Definition: CConsoleWnd.h:52

Referenced by CConsoleWnd::OnCreate().

◆ SaveMscFile()

LRESULT CMainWnd::SaveMscFile ( const CAtlString &  FileName)
private

Definition at line 995 of file CMainWnd.cpp.

996{
997 IXMLDOMElement *pRootNode = NULL;
998 IXMLDOMElement *pNode = NULL;
999 IXMLDOMElement *pFrameStateNode = NULL;
1000 IXMLDOMElement *pViewsNode = NULL;
1001 IXMLDOMElement *pScopeTreeNode = NULL;
1002 IXMLDOMElement *pSnapinCacheNode = NULL;
1003 IXMLDOMElement *pSnapinNode = NULL;
1004 IXMLDOMElement *pNodesNode = NULL;
1005 POSITION pos;
1006 CConsoleWnd* console;
1007 HRESULT hr = S_OK;
1008
1009 MscFile *mscFile = new MscFile(FileName.GetString());
1010
1011 CHK_HR(mscFile->CreateAndInitDOM());
1012
1013 /* <?xml version="1.0"?> */
1014 CHK_HR(mscFile->CreateAndAddPINode(L"xml", L"version='1.0'"));
1015
1016 /* <MMC_ConsoleFile ConsoleVersion="2.0" ProgramMode="Author"> */
1017 CHK_HR(mscFile->CreateElement(L"MMC_ConsoleFile", &pRootNode));
1018 CHK_HR(mscFile->CreateAndAddAttributeNode(L"ConsoleVersion", L"2.0", pRootNode));
1019 CHK_HR(mscFile->CreateAndAddAttributeNode(L"ProgramMode", ::DocumentModeToString(m_DocumentMode), pRootNode));
1020
1021 /* <ConsoleFileID> */
1022 CHK_HR(mscFile->CreateAndAddElementNode(L"ConsoleFileID", pRootNode, &pNode));
1023 CHK_HR(mscFile->CreateAndAddTextNode(L"{Random GUID}", pNode));
1024 SAFE_RELEASE(pNode); /* </ConsoleFileID> */
1025
1026 /* <FrameState> */
1027 CHK_HR(mscFile->CreateAndAddElementNode(L"FrameState", pRootNode, &pFrameStateNode));
1028 CHK_HR(mscFile->CreateAndAddAttributeNode(L"ShowStatusBar", L"true", pFrameStateNode));
1030 CHK_HR(mscFile->CreateAndAddAttributeNode(L"LogicalReadOnly", L"true", pFrameStateNode));
1032 CHK_HR(mscFile->CreateAndAddAttributeNode(L"PreventViewCustomization", L"true", pFrameStateNode));
1033
1034 mscFile->SaveWindowPlacement(this, pFrameStateNode);
1035
1036 SAFE_RELEASE(pFrameStateNode); /* </FrameState> */
1037
1038 /* <Views> */
1039 CHK_HR(mscFile->CreateAndAddElementNode(L"Views", pRootNode, &pViewsNode));
1040 pos = m_ViewList.GetHeadPosition();
1041 do
1042 {
1043 console = (CConsoleWnd*)m_ViewList.GetNext(pos);
1044 if (console)
1045 console->SaveView(mscFile, pViewsNode);
1046
1047 } while (pos != NULL);
1048 SAFE_RELEASE(pViewsNode); /* </Views> */
1049
1050 /* <ScopeTree> */
1051 CHK_HR(mscFile->CreateAndAddElementNode(L"ScopeTree", pRootNode, &pScopeTreeNode));
1052
1053 /* <SnapinCache> */
1054 CHK_HR(mscFile->CreateAndAddElementNode(L"SnapinCache", pScopeTreeNode, &pSnapinCacheNode));
1055
1056 for (int i = 0; i < GetSnapinCacheCount(); i++)
1057 {
1059 if (entry)
1060 {
1061 /* <Snapin> */
1062 CHK_HR(mscFile->CreateAndAddElementNode(L"Snapin", pSnapinCacheNode, &pSnapinNode));
1063 CHK_HR(mscFile->CreateAndAddAttributeNode(L"CLSID", entry->GuidString().GetString(), pSnapinNode));
1064 CHK_HR(mscFile->CreateAndAddAttributeNode(L"AllExtensionsEnabled", L"true", pSnapinNode)); /* FIXME */
1065 CHK_HR(mscFile->CreateAndAddAttributeNode(L"Name", entry->Name().GetString(), pSnapinNode));
1066 CHK_HR(mscFile->CreateAndAddAttributeNode(L"Provider", entry->Provider().GetString(), pSnapinNode));
1067 SAFE_RELEASE(pSnapinNode); /* </Snapin> */
1068 }
1069 }
1070 SAFE_RELEASE(pSnapinCacheNode); /* </SnapinCache> */
1071
1072 /* <Nodes> */
1073 CHK_HR(mscFile->CreateAndAddElementNode(L"Nodes", pScopeTreeNode, &pNodesNode));
1074 if (m_RootNode)
1075 m_RootNode->SaveNode(mscFile, pNodesNode);
1076 SAFE_RELEASE(pNodesNode); /* </Nodes> */
1077
1078 SAFE_RELEASE(pScopeTreeNode); /* </ScopeTree> */
1079
1080 CHK_HR(mscFile->AppendChildToParent(pRootNode));
1081
1082 CHK_HR(mscFile->SaveDOM());
1083
1084CleanUp:
1085 SAFE_RELEASE(pRootNode); /* </MMC_ConsoleFile> */
1086
1087 delete mscFile;
1088
1089 return 0;
1090}
LPWSTR DocumentModeToString(DOCUMENT_MODE DocumentMode)
Definition: misc.cpp:206
VOID SaveView(MscFile *mscFile, IXMLDOMElement *pParentElement)
int GetSnapinCacheCount()
Definition: CMainWnd.cpp:638
CSnapinCacheEntry * GetSnapinCacheEntry(int nIndex)
Definition: CMainWnd.cpp:644
VOID SaveNode(MscFile *mscFile, IXMLDOMElement *pParentNode)
Definition: CSnapin.cpp:122
HRESULT CreateAndAddTextNode(PCWSTR wszText, IXMLDOMNode *pParent)
Definition: mscfile.cpp:165
HRESULT CreateElement(PCWSTR wszName, IXMLDOMElement **ppElement)
Definition: mscfile.cpp:65
HRESULT SaveWindowPlacement(CWindow *pWindow, IXMLDOMElement *pParentNode)
Definition: mscfile.cpp:222
HRESULT SaveDOM()
Definition: mscfile.cpp:421
HRESULT CreateAndAddAttributeNode(PCWSTR wszName, PCWSTR wszValue, IXMLDOMElement *pParent)
Definition: mscfile.cpp:137
HRESULT AppendChildToParent(IXMLDOMNode *pChild, IXMLDOMNode *pParent=NULL)
Definition: mscfile.cpp:81
HRESULT CreateAndAddPINode(PCWSTR wszTarget, PCWSTR wszData)
Definition: mscfile.cpp:97
HRESULT CreateAndAddElementNode(PCWSTR wszName, IXMLDOMNode *pParent, IXMLDOMElement **ppElement=NULL)
Definition: mscfile.cpp:204
#define SAFE_RELEASE(p)
Definition: mscfile.h:15
#define CHK_HR(stmt)
Definition: mscfile.h:9

Referenced by OnFileSave(), and OnFileSaveAs().

◆ SetConsoleTitle()

void CMainWnd::SetConsoleTitle ( CAtlString  consoleTitle)

Definition at line 580 of file CMainWnd.cpp.

581{
582 m_ConsoleTitle = consoleTitle;
583 SetWindowTextW(consoleTitle.GetString());
584}
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)

Referenced by COptionsDialog::OnCommand().

◆ SetDocumentMode()

void CMainWnd::SetDocumentMode ( DOCUMENT_MODE  DocumentMode)

Definition at line 779 of file CMainWnd.cpp.

780{
781 m_DocumentMode = DocumentMode;
782}

Referenced by COptionsDialog::OnCommand().

◆ SetLogicalReadOnly()

void CMainWnd::SetLogicalReadOnly ( BOOL  LogicalReadOnly)

Definition at line 791 of file CMainWnd.cpp.

792{
793 m_LogicalReadOnly = LogicalReadOnly;
794}

Referenced by COptionsDialog::OnCommand().

◆ SetPreventViewCustomization()

void CMainWnd::SetPreventViewCustomization ( BOOL  PreventCustomization)

Definition at line 803 of file CMainWnd.cpp.

804{
805 m_PreventViewCustomization = PreventCustomization;
806}

Referenced by COptionsDialog::OnCommand().

◆ SetStandardMenusVisible()

VOID CMainWnd::SetStandardMenusVisible ( BOOL  bVisible)

Definition at line 606 of file CMainWnd.cpp.

607{
608 m_bStandardMenusVisible = bVisible;
609// m_MainWnd->UpdateMenu(m_bStandardMenusVisible);
610// UpdateLayout();
611}

Referenced by CCustomizeDialog::OnCommand().

◆ SetToolBarVisible()

VOID CMainWnd::SetToolBarVisible ( BOOL  bVisible)

Definition at line 593 of file CMainWnd.cpp.

594{
595 m_bToolBarVisible = bVisible;
596 UpdateLayout();
597}

Referenced by CCustomizeDialog::OnCommand().

◆ SnapinImageList()

HIMAGELIST CMainWnd::SnapinImageList ( )

Definition at line 662 of file CMainWnd.cpp.

663{
664 return m_hSnapinImageList;
665}

Referenced by CAddDialog::InitCB(), CAddDialog::InitLV(), CAddDialog::InitTV(), and CConsoleWnd::OnCreate().

◆ UnregisterView()

VOID CMainWnd::UnregisterView ( CConsoleWnd *  pView)

Definition at line 684 of file CMainWnd.cpp.

685{
686 POSITION pos = m_ViewList.Find(pView);
687 if (pos)
688 {
689 m_ViewList.RemoveAt(pos);
690 pView->m_ViewId = 0;
691 }
692}

Referenced by CConsoleWnd::OnDestroy().

◆ UpdateAboutSnapinMenu()

VOID CMainWnd::UpdateAboutSnapinMenu ( CSnapin *  Snapin)

Definition at line 809 of file CMainWnd.cpp.

810{
811 HMENU hMenu = GetMenu();
812
814
815 if (Snapin)
816 {
820
821 ValueName.Format(AboutString.GetString(), Snapin->Name().GetString());
822
823 mi.cbSize = sizeof(MENUITEMINFOW);
825 mi.fType = MFT_STRING;
827
828 mi.dwTypeData = ValueName.GetString();
829 mi.dwItemData = (ULONG_PTR)Snapin;
830
831 /* FIXME: Append this menu item */
833 }
834}
#define IDM_HELP_ABOUT_MMC
Definition: resource.h:60
#define IDM_HELP_ABOUT_SNAPIN
Definition: resource.h:61
#define IDS_ABOUT_SNAPIN
Definition: resource.h:126
const CAtlString & Name() const
Definition: CSnapin.cpp:37
#define ULONG_PTR
Definition: config.h:101
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define MIIM_STRING
Definition: winuser.h:738
#define MIIM_ID
Definition: winuser.h:733
#define MIIM_FTYPE
Definition: winuser.h:740
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MFT_STRING
Definition: winuser.h:757
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)

Referenced by CConsoleWnd::OnNotify().

◆ UpdateLayout()

VOID CMainWnd::UpdateLayout ( )

Definition at line 723 of file CMainWnd.cpp.

724{
725 RECT rcClient, rcToolBar = {0, 0, 0, 0};
726 GetClientRect(&rcClient);
727
728 int nToolBarFlags = SWP_NOZORDER;
729 if (m_bToolBarVisible && !m_ViewList.IsEmpty())
730 {
731 rcClient.top += m_iToolBarHeight;
732 rcClient.bottom -= m_iToolBarHeight;
733
734 rcToolBar.right = rcClient.right;
735 rcToolBar.bottom = m_iToolBarHeight;
736 nToolBarFlags |= SWP_SHOWWINDOW;
737 }
738 else
739 {
740 nToolBarFlags |= SWP_HIDEWINDOW;
741 }
742
743 m_ToolBar.SetWindowPos(NULL, rcToolBar.left, rcToolBar.top, rcToolBar.right, rcToolBar.bottom, nToolBarFlags);
744
745 m_MDIClient.SetWindowPos(NULL, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom, SWP_NOZORDER);
746}
BOOL SetWindowPos(HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
Definition: atlwin.h:1288
#define SWP_SHOWWINDOW
Definition: winuser.h:1259
#define SWP_HIDEWINDOW
Definition: winuser.h:1252
#define SWP_NOZORDER
Definition: winuser.h:1258
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29

Referenced by CreateView(), CConsoleWnd::OnActionNewWindow(), OnCloseChild(), OnSize(), CConsoleWnd::ParseView(), and SetToolBarVisible().

◆ UpdateMenu()

VOID CMainWnd::UpdateMenu ( )

Definition at line 749 of file CMainWnd.cpp.

750{
751 if (m_ViewList.IsEmpty())
752 {
754 }
755 else
756 {
759 }
760}

Referenced by CreateView(), CConsoleWnd::OnActionNewWindow(), OnCloseChild(), and CConsoleWnd::ParseView().

◆ UpdateNextNodeId()

VOID CMainWnd::UpdateNextNodeId ( UINT  NodeId)

Definition at line 701 of file CMainWnd.cpp.

702{
703 if (NodeId >= m_NextNodeId)
704 m_NextNodeId = NodeId + 1;
705}

Referenced by CSnapin::ParseSnapin().

◆ UpdateRecentFilesMenu()

VOID CMainWnd::UpdateRecentFilesMenu ( )
private

Definition at line 860 of file CMainWnd.cpp.

861{
863 HMENU hMenu = GetMenu();
864
865 mi.cbSize = sizeof(MENUITEMINFOW);
867 mi.fType = MFT_STRING;
868 mi.wID = IDM_FILE_RECENT1;
869
871
872 INT i = 0;
874 POSITION pos = m_RecentFilesList.GetHeadPosition();
875 while (pos != NULL)
876 {
878
879 CRecentFileEntry *FileEntry = m_RecentFilesList.GetNext(pos);
880 ValueName.Format(L"%d %s", i + 1, FileEntry->DisplayName().GetString());
881 mi.dwTypeData = ValueName.GetString();
882 mi.dwItemData = (ULONG_PTR)FileEntry;
883
885 mi.wID++;
886
887 i++;
888 if (i >= MAX_RECENT_FILES)
889 break;
890 }
891
892 mi.fType = MFT_SEPARATOR;
893 mi.fMask = MIIM_FTYPE | MIIM_ID;
895}
#define IDM_FILE_EXIT
Definition: resource.h:15
#define IDM_FILE_RECENT1
Definition: resource.h:33
#define IDM_FILE_RECENT_SEP
Definition: resource.h:37
const CAtlString & DisplayName() const
#define MFT_SEPARATOR
Definition: winuser.h:755

Referenced by AddToRecentFiles(), LoadRecentFiles(), and UpdateMenu().

◆ UpdateTitle()

VOID CMainWnd::UpdateTitle ( )

Definition at line 763 of file CMainWnd.cpp.

764{
765 if (m_ViewList.IsEmpty())
767 else
770}
BOOL LoadString(_In_ UINT nID)
Definition: cstringt.h:639
void CreateNewConsoleTitle(CAtlString &str)
Definition: CMainWnd.h:168

Referenced by CreateView(), CConsoleWnd::OnActionNewWindow(), OnCloseChild(), and CConsoleWnd::ParseView().

◆ UpdateToolbuttons()

VOID CMainWnd::UpdateToolbuttons ( BOOL  bTreeViewVisible,
BOOL  bActionsPaneVisible 
)

Definition at line 853 of file CMainWnd.cpp.

854{
855 m_ToolBar.CheckButton(IDM_TB_SCOPE_PANE, bTreeViewVisible);
856 m_ToolBar.CheckButton(IDM_TB_ACTIONS_PANE, bActionsPaneVisible);
857}
#define IDM_TB_ACTIONS_PANE
Definition: resource.h:70
#define IDM_TB_SCOPE_PANE
Definition: resource.h:67
DWORD CheckButton(int cmdId, BOOL bCheck)
Definition: rosctrls.h:362

Referenced by CConsoleWnd::OnActivate(), and CCustomizeDialog::OnCommand().

◆ UpdateUpToolButton()

VOID CMainWnd::UpdateUpToolButton ( BOOL  bShow)

Definition at line 847 of file CMainWnd.cpp.

848{
850}
#define IDM_TB_UP
Definition: resource.h:66
DWORD HideButton(int cmdId, BOOL bHide)
Definition: rosctrls.h:367

Referenced by CConsoleWnd::OnNotify().

◆ UpdateViewMenu()

VOID CMainWnd::UpdateViewMenu ( LISTVIEW_MODE  ListViewMode)

Definition at line 837 of file CMainWnd.cpp.

838{
842 ViewModeToCmdId(ListViewMode),
844}
UINT ViewModeToCmdId(LISTVIEW_MODE ListViewMode)
Definition: misc.cpp:11

Referenced by CreateView(), CConsoleWnd::OnActionNewWindow(), CConsoleWnd::OnActivate(), CConsoleWnd::OnCreate(), and CConsoleWnd::ParseView().

◆ UpdateViews()

VOID CMainWnd::UpdateViews ( )

Definition at line 708 of file CMainWnd.cpp.

709{
710 CConsoleWnd *console;
712
713 pos = m_ViewList.GetHeadPosition();
714 while (pos)
715 {
716 console = (CConsoleWnd*)m_ViewList.GetNext(pos);
717 if (console)
718 console->UpdateView();
719 }
720}
VOID UpdateView()

Referenced by OnFileAdd().

◆ XDefFrameProc()

static LRESULT CALLBACK CMainWnd::XDefFrameProc ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
inlinestatic

Definition at line 136 of file CMainWnd.h.

137 {
138 CMainWnd* pThis = reinterpret_cast<CMainWnd*>(hWnd);
139 return ::DefFrameProc(pThis->m_hWnd, pThis->m_MDIClient.m_hWnd, uMsg, wParam, lParam);
140 }
HWND hWnd
Definition: settings.c:17

Referenced by CMainWnd().

Member Data Documentation

◆ m_bStandardMenusVisible

BOOL CMainWnd::m_bStandardMenusVisible
private

Definition at line 41 of file CMainWnd.h.

Referenced by AreStandardMenusVisible(), OnCreate(), and SetStandardMenusVisible().

◆ m_bToolBarVisible

BOOL CMainWnd::m_bToolBarVisible
private

Definition at line 39 of file CMainWnd.h.

Referenced by InitMain(), IsToolBarVisible(), OnCreate(), SetToolBarVisible(), and UpdateLayout().

◆ m_ConsoleNumber

int CMainWnd::m_ConsoleNumber
private

Definition at line 29 of file CMainWnd.h.

Referenced by CreateNewConsoleTitle(), OnFileNew(), OnFileOpen(), OnFileRecent(), and OnFileSaveAs().

◆ m_ConsoleTitle

CAtlString CMainWnd::m_ConsoleTitle
private

Definition at line 30 of file CMainWnd.h.

Referenced by GetConsoleTitle(), SetConsoleTitle(), and UpdateTitle().

◆ m_DocumentMode

DOCUMENT_MODE CMainWnd::m_DocumentMode
private

Definition at line 33 of file CMainWnd.h.

Referenced by GetDocumentMode(), InitMain(), LoadMscFile(), SaveMscFile(), and SetDocumentMode().

◆ m_Filename

CAtlString CMainWnd::m_Filename

Definition at line 56 of file CMainWnd.h.

Referenced by OnFileOpen(), OnFileSave(), and OnFileSaveAs().

◆ m_FrameThunk

CWndProcThunk CMainWnd::m_FrameThunk
private

Definition at line 27 of file CMainWnd.h.

Referenced by CMainWnd().

◆ m_hMenuConsoleLarge

HMENU CMainWnd::m_hMenuConsoleLarge
private

Definition at line 32 of file CMainWnd.h.

Referenced by CMainWnd(), OnCreate(), UpdateMenu(), and ~CMainWnd().

◆ m_hMenuConsoleSmall

HMENU CMainWnd::m_hMenuConsoleSmall
private

Definition at line 31 of file CMainWnd.h.

Referenced by CMainWnd(), UpdateMenu(), and ~CMainWnd().

◆ m_hSnapinImageList

HIMAGELIST CMainWnd::m_hSnapinImageList
private

Definition at line 44 of file CMainWnd.h.

Referenced by CMainWnd(), LoadSnapinCache(), SnapinImageList(), and ~CMainWnd().

◆ m_hToolBarImageList

HIMAGELIST CMainWnd::m_hToolBarImageList
private

Definition at line 40 of file CMainWnd.h.

Referenced by CMainWnd(), OnCreate(), and ~CMainWnd().

◆ m_iToolBarHeight

int CMainWnd::m_iToolBarHeight
private

Definition at line 38 of file CMainWnd.h.

Referenced by OnCreate(), and UpdateLayout().

◆ m_LogicalReadOnly

BOOL CMainWnd::m_LogicalReadOnly
private

Definition at line 34 of file CMainWnd.h.

Referenced by GetLogicalReadOnly(), InitMain(), LoadMscFile(), SaveMscFile(), and SetLogicalReadOnly().

◆ m_MDIClient

◆ m_NextNodeId

UINT CMainWnd::m_NextNodeId
private

Definition at line 50 of file CMainWnd.h.

Referenced by GetNextNodeId(), InitMain(), OnFileNew(), and UpdateNextNodeId().

◆ m_NextViewId

UINT CMainWnd::m_NextViewId
private

Definition at line 47 of file CMainWnd.h.

Referenced by InitMain(), and RegisterView().

◆ m_PreventViewCustomization

BOOL CMainWnd::m_PreventViewCustomization
private

◆ m_RecentFilesList

CAtlList<CRecentFileEntry *> CMainWnd::m_RecentFilesList
private

Definition at line 52 of file CMainWnd.h.

Referenced by AddToRecentFiles(), LoadRecentFiles(), and UpdateRecentFilesMenu().

◆ m_RootNode

CSnapin* CMainWnd::m_RootNode
private

Definition at line 49 of file CMainWnd.h.

Referenced by GetRootSnapin(), InitMain(), OnFileNew(), OnWindowsNew(), ParseScopeTree(), and SaveMscFile().

◆ m_SnapinCache

CSimpleArray<CSnapinCacheEntry*> CMainWnd::m_SnapinCache
private

◆ m_TempNodeMap

CSimpleMap<UINT, CSnapin*>* CMainWnd::m_TempNodeMap

Definition at line 59 of file CMainWnd.h.

Referenced by LoadMscFile(), CSnapin::ParseSnapin(), and CConsoleWnd::ParseView().

◆ m_ToolBar

CToolbar<DWORD_PTR> CMainWnd::m_ToolBar
private

Definition at line 37 of file CMainWnd.h.

Referenced by OnCreate(), UpdateLayout(), UpdateToolbuttons(), and UpdateUpToolButton().

◆ m_ViewList

CAtlList<CConsoleWnd*> CMainWnd::m_ViewList
private

The documentation for this class was generated from the following files: