4 * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
35 /********************************************************************************
36 * Global and Local Variables:
39 static BOOL bInMenuLoop
= FALSE
; /* Tells us if we are in the menu loop */
41 /*******************************************************************************
42 * Local module support methods
45 static void resize_frame_rect(HWND hWnd
, PRECT prect
)
49 if (IsWindowVisible(hToolBar)) {
50 SendMessage(hToolBar, WM_SIZE, 0, 0);
51 GetClientRect(hToolBar, &rt);
52 prect->top = rt.bottom+3;
53 prect->bottom -= rt.bottom+3;
56 if (IsWindowVisible(hStatusBar
)) {
57 SetupStatusBar(hWnd
, TRUE
);
58 GetClientRect(hStatusBar
, &rt
);
59 prect
->bottom
-= rt
.bottom
;
61 MoveWindow(g_pChildWnd
->hWnd
, prect
->left
, prect
->top
, prect
->right
, prect
->bottom
, TRUE
);
64 static void resize_frame_client(HWND hWnd
)
68 GetClientRect(hWnd
, &rect
);
69 resize_frame_rect(hWnd
, &rect
);
72 /********************************************************************************/
74 static void OnEnterMenuLoop(HWND hWnd
)
78 /* Update the status bar pane sizes */
80 SendMessage(hStatusBar
, SB_SETPARTS
, 1, (LPARAM
)&nParts
);
82 SendMessage(hStatusBar
, SB_SETTEXT
, (WPARAM
)0, (LPARAM
)_T(""));
85 static void OnExitMenuLoop(HWND hWnd
)
88 /* Update the status bar pane sizes*/
89 SetupStatusBar(hWnd
, TRUE
);
93 static void OnMenuSelect(HWND hWnd
, UINT nItemID
, UINT nFlags
, HMENU hSysMenu
)
98 if (nFlags
& MF_POPUP
) {
99 if (hSysMenu
!= GetMenu(hWnd
)) {
100 if (nItemID
== 2) nItemID
= 5;
103 if (LoadString(hInst
, nItemID
, str
, 100)) {
104 /* load appropriate string*/
106 /* first newline terminates actual string*/
107 lpsz
= _tcschr(lpsz
, '\n');
111 SendMessage(hStatusBar
, SB_SETTEXT
, 0, (LPARAM
)str
);
114 void SetupStatusBar(HWND hWnd
, BOOL bResize
)
118 GetClientRect(hWnd
, &rc
);
122 SendMessage(hStatusBar
, WM_SIZE
, 0, 0);
123 SendMessage(hStatusBar
, SB_SETPARTS
, 1, (LPARAM
)&nParts
);
126 void UpdateStatusBar(void)
131 size
= sizeof(text
)/sizeof(TCHAR
);
132 GetComputerName(text
, &size
);
133 SendMessage(hStatusBar
, SB_SETTEXT
, 0, (LPARAM
)text
);
136 static void toggle_child(HWND hWnd
, UINT cmd
, HWND hchild
)
138 BOOL vis
= IsWindowVisible(hchild
);
139 HMENU hMenuView
= GetSubMenu(hMenuFrame
, ID_VIEW_MENU
);
141 CheckMenuItem(hMenuView
, cmd
, vis
?MF_BYCOMMAND
:MF_BYCOMMAND
|MF_CHECKED
);
142 ShowWindow(hchild
, vis
?SW_HIDE
:SW_SHOW
);
143 resize_frame_client(hWnd
);
146 static BOOL
CheckCommDlgError(HWND hWnd
)
148 DWORD dwErrorCode
= CommDlgExtendedError();
149 switch (dwErrorCode
) {
150 case CDERR_DIALOGFAILURE
:
152 case CDERR_FINDRESFAILURE
:
154 case CDERR_NOHINSTANCE
:
156 case CDERR_INITIALIZATION
:
160 case CDERR_LOCKRESFAILURE
:
162 case CDERR_NOTEMPLATE
:
164 case CDERR_LOADRESFAILURE
:
166 case CDERR_STRUCTSIZE
:
168 case CDERR_LOADSTRFAILURE
:
170 case FNERR_BUFFERTOOSMALL
:
172 case CDERR_MEMALLOCFAILURE
:
174 case FNERR_INVALIDFILENAME
:
176 case CDERR_MEMLOCKFAILURE
:
178 case FNERR_SUBCLASSFAILURE
:
186 #define MAX_CUSTOM_FILTER_SIZE 50
187 TCHAR CustomFilterBuffer
[MAX_CUSTOM_FILTER_SIZE
];
188 TCHAR FileNameBuffer
[_MAX_PATH
];
189 TCHAR FileTitleBuffer
[_MAX_PATH
];
195 } FILTERPAIR
, *PFILTERPAIR
;
198 BuildFilterStrings(TCHAR
*Filter
, PFILTERPAIR Pairs
, int PairCount
)
203 for(i
= 0; i
< PairCount
; i
++)
205 c
+= LoadString(hInst
, Pairs
[i
].DisplayID
, &Filter
[c
], 255 * sizeof(TCHAR
));
207 c
+= LoadString(hInst
, Pairs
[i
].FilterID
, &Filter
[c
], 255 * sizeof(TCHAR
));
213 static BOOL
InitOpenFileName(HWND hWnd
, OPENFILENAME
* pofn
)
215 FILTERPAIR FilterPairs
[3];
216 static TCHAR Filter
[1024];
218 memset(pofn
, 0, sizeof(OPENFILENAME
));
219 pofn
->lStructSize
= sizeof(OPENFILENAME
);
220 pofn
->hwndOwner
= hWnd
;
221 pofn
->hInstance
= hInst
;
223 /* create filter string */
224 FilterPairs
[0].DisplayID
= IDS_FLT_REGFILES
;
225 FilterPairs
[0].FilterID
= IDS_FLT_REGFILES_FLT
;
226 FilterPairs
[1].DisplayID
= IDS_FLT_REGEDIT4
;
227 FilterPairs
[1].FilterID
= IDS_FLT_REGEDIT4_FLT
;
228 FilterPairs
[2].DisplayID
= IDS_FLT_ALLFILES
;
229 FilterPairs
[2].FilterID
= IDS_FLT_ALLFILES_FLT
;
230 BuildFilterStrings(Filter
, FilterPairs
, sizeof(FilterPairs
) / sizeof(FILTERPAIR
));
232 pofn
->lpstrFilter
= Filter
;
233 pofn
->lpstrCustomFilter
= CustomFilterBuffer
;
234 pofn
->nMaxCustFilter
= MAX_CUSTOM_FILTER_SIZE
;
235 pofn
->nFilterIndex
= 0;
236 pofn
->lpstrFile
= FileNameBuffer
;
237 pofn
->nMaxFile
= _MAX_PATH
;
238 pofn
->lpstrFileTitle
= FileTitleBuffer
;
239 pofn
->nMaxFileTitle
= _MAX_PATH
;
240 /* pofn->lpstrInitialDir = _T("");*/
241 /* pofn->lpstrTitle = _T("Import Registry File");*/
242 /* pofn->Flags = OFN_ENABLETEMPLATE + OFN_EXPLORER + OFN_ENABLESIZING;*/
243 pofn
->Flags
= OFN_HIDEREADONLY
;
244 /* pofn->nFileOffset = ;*/
245 /* pofn->nFileExtension = ;*/
246 /* pofn->lpstrDefExt = _T("");*/
247 /* pofn->lCustData = ;*/
248 /* pofn->lpfnHook = ImportRegistryFile_OFNHookProc;*/
249 /* pofn->lpTemplateName = _T("ID_DLG_IMPORT_REGFILE");*/
250 /* pofn->lpTemplateName = MAKEINTRESOURCE(IDD_DIALOG1);*/
251 /* pofn->FlagsEx = ;*/
255 static BOOL
ImportRegistryFile(HWND hWnd
)
260 InitOpenFileName(hWnd
, &ofn
);
261 LoadString(hInst
, IDS_IMPORT_REG_FILE
, Caption
, sizeof(Caption
)/sizeof(TCHAR
));
262 ofn
.lpstrTitle
= Caption
;
263 /* ofn.lCustData = ;*/
264 if (GetOpenFileName(&ofn
)) {
265 /* FIXME - convert to ascii */
266 if (!import_registry_file((LPSTR
)ofn
.lpstrFile
)) {
267 /*printf("Can't open file \"%s\"\n", ofn.lpstrFile);*/
271 get_file_name(&s
, filename
, MAX_PATH
);
273 printf("No file name is specified\n%s", usage
);
277 while (filename
[0]) {
278 if (!import_registry_file(filename
)) {
280 printf("Can't open file \"%s\"\n", filename
);
284 get_file_name(&s
, filename
, MAX_PATH
);
289 CheckCommDlgError(hWnd
);
295 static UINT_PTR CALLBACK
ExportRegistryFile_OFNHookProc(HWND hdlg
, UINT uiMsg
, WPARAM wParam
, LPARAM lParam
)
298 UINT_PTR iResult
= 0;
302 hControl
= GetDlgItem(hdlg
, IDC_EXPORT_ALL
);
305 EnableWindow(hControl
, FALSE
);
306 SendMessage(hControl
, BM_SETCHECK
, BST_CHECKED
, 0);
309 hControl
= GetDlgItem(hdlg
, IDC_EXPORT_BRANCH
);
312 EnableWindow(hControl
, FALSE
);
313 SendMessage(hControl
, BM_SETCHECK
, BST_UNCHECKED
, 0);
316 hControl
= GetDlgItem(hdlg
, IDC_EXPORT_BRANCH_TEXT
);
319 EnableWindow(hControl
, FALSE
);
326 static BOOL
ExportRegistryFile(HWND hWnd
)
329 TCHAR ExportKeyPath
[_MAX_PATH
];
332 ExportKeyPath
[0] = _T('\0');
333 InitOpenFileName(hWnd
, &ofn
);
334 LoadString(hInst
, IDS_EXPORT_REG_FILE
, Caption
, sizeof(Caption
)/sizeof(TCHAR
));
335 ofn
.lpstrTitle
= Caption
;
336 /* ofn.lCustData = ;*/
337 ofn
.Flags
= OFN_ENABLETEMPLATE
| OFN_EXPLORER
| OFN_ENABLEHOOK
;
338 ofn
.lpfnHook
= ExportRegistryFile_OFNHookProc
;
339 ofn
.lpTemplateName
= MAKEINTRESOURCE(IDD_EXPORTRANGE
);
340 if (GetSaveFileName(&ofn
)) {
342 /* FIXME - convert strings to ascii! */
343 result
= export_registry_key((CHAR
*)ofn
.lpstrFile
, (CHAR
*)ExportKeyPath
);
344 /*result = export_registry_key(ofn.lpstrFile, NULL);*/
345 /*if (!export_registry_key(ofn.lpstrFile, NULL)) {*/
347 /*printf("Can't open file \"%s\"\n", ofn.lpstrFile);*/
351 TCHAR filename
[MAX_PATH
];
353 get_file_name(&s
, filename
, MAX_PATH
);
355 printf("No file name is specified\n%s", usage
);
360 TCHAR reg_key_name
[KEY_MAX_LEN
];
361 get_file_name(&s
, reg_key_name
, KEY_MAX_LEN
);
362 export_registry_key((CHAR
)filename
, reg_key_name
);
364 export_registry_key(filename
, NULL
);
369 CheckCommDlgError(hWnd
);
374 BOOL
PrintRegistryHive(HWND hWnd
, LPTSTR path
)
379 ZeroMemory(&pd
, sizeof(PRINTDLG
));
380 pd
.lStructSize
= sizeof(PRINTDLG
);
382 pd
.hDevMode
= NULL
; /* Don't forget to free or store hDevMode*/
383 pd
.hDevNames
= NULL
; /* Don't forget to free or store hDevNames*/
384 pd
.Flags
= PD_USEDEVMODECOPIESANDCOLLATE
| PD_RETURNDC
;
386 pd
.nFromPage
= 0xFFFF;
389 pd
.nMaxPage
= 0xFFFF;
391 /* GDI calls to render output. */
392 DeleteDC(pd
.hDC
); /* Delete DC when done.*/
398 hResult
= PrintDlgEx(&pd
);
399 if (hResult
== S_OK
) {
400 switch (pd
.dwResultAction
) {
401 case PD_RESULT_APPLY
:
402 /*The user clicked the Apply button and later clicked the Cancel button. This indicates that the user wants to apply the changes made in the property sheet, but does not yet want to print. The PRINTDLGEX structure contains the information specified by the user at the time the Apply button was clicked. */
404 case PD_RESULT_CANCEL
:
405 /*The user clicked the Cancel button. The information in the PRINTDLGEX structure is unchanged. */
407 case PD_RESULT_PRINT
:
408 /*The user clicked the Print button. The PRINTDLGEX structure contains the information specified by the user. */
416 /*Insufficient memory. */
419 /* One or more arguments are invalid. */
422 /*Invalid pointer. */
428 /*Unspecified error. */
439 static BOOL
CopyKeyName(HWND hWnd
, LPCTSTR keyName
)
443 result
= OpenClipboard(hWnd
);
445 result
= EmptyClipboard();
448 /*HANDLE hClipData;*/
449 /*hClipData = SetClipboardData(UINT uFormat, HANDLE hMem);*/
452 /* error emptying clipboard*/
453 /* DWORD dwError = GetLastError(); */
456 if (!CloseClipboard()) {
457 /* error closing clipboard*/
458 /* DWORD dwError = GetLastError(); */
462 /* error opening clipboard*/
463 /* DWORD dwError = GetLastError(); */
469 static BOOL
CreateNewValue(HKEY hRootKey
, LPCTSTR pszKeyPath
, DWORD dwType
)
471 TCHAR szNewValueFormat
[128];
472 TCHAR szNewValue
[128];
475 DWORD dwExistingType
, cbData
;
480 if (RegOpenKey(hRootKey
, pszKeyPath
, &hKey
) != ERROR_SUCCESS
)
483 LoadString(hInst
, IDS_NEW_VALUE
, szNewValueFormat
, sizeof(szNewValueFormat
)
484 / sizeof(szNewValueFormat
[0]));
488 _sntprintf(szNewValue
, sizeof(szNewValue
) / sizeof(szNewValue
[0]),
489 szNewValueFormat
, iIndex
++);
491 cbData
= sizeof(data
);
492 lResult
= RegQueryValueEx(hKey
, szNewValue
, NULL
, &dwExistingType
, data
, &cbData
);
494 while(lResult
== ERROR_SUCCESS
);
498 cbData
= sizeof(DWORD
);
502 cbData
= sizeof(TCHAR
);
505 cbData
= sizeof(TCHAR
) * 2;
508 cbData
= sizeof(DWORD
) * 2;
514 memset(data
, 0, cbData
);
515 lResult
= RegSetValueEx(hKey
, szNewValue
, 0, dwType
, data
, cbData
);
516 if (lResult
!= ERROR_SUCCESS
)
519 RefreshListView(g_pChildWnd
->hListWnd
, hRootKey
, pszKeyPath
);
521 /* locate the newly added value, and get ready to rename it */
522 memset(&lvfi
, 0, sizeof(lvfi
));
523 lvfi
.flags
= LVFI_STRING
;
524 lvfi
.psz
= szNewValue
;
525 iIndex
= ListView_FindItem(g_pChildWnd
->hListWnd
, -1, &lvfi
);
527 ListView_EditLabel(g_pChildWnd
->hListWnd
, iIndex
);
533 InitializeRemoteRegistryPicker(OUT IDsObjectPicker
**pDsObjectPicker
)
537 *pDsObjectPicker
= NULL
;
539 hRet
= CoCreateInstance(&CLSID_DsObjectPicker
,
541 CLSCTX_INPROC_SERVER
,
542 &IID_IDsObjectPicker
,
543 (LPVOID
*)pDsObjectPicker
);
546 DSOP_INIT_INFO InitInfo
;
547 DSOP_SCOPE_INIT_INFO Scopes
[] =
550 sizeof(DSOP_SCOPE_INIT_INFO
),
551 DSOP_SCOPE_TYPE_USER_ENTERED_UPLEVEL_SCOPE
| DSOP_SCOPE_TYPE_USER_ENTERED_DOWNLEVEL_SCOPE
|
552 DSOP_SCOPE_TYPE_GLOBAL_CATALOG
| DSOP_SCOPE_TYPE_EXTERNAL_UPLEVEL_DOMAIN
|
553 DSOP_SCOPE_TYPE_EXTERNAL_DOWNLEVEL_DOMAIN
| DSOP_SCOPE_TYPE_WORKGROUP
|
554 DSOP_SCOPE_TYPE_UPLEVEL_JOINED_DOMAIN
| DSOP_SCOPE_TYPE_DOWNLEVEL_JOINED_DOMAIN
,
558 DSOP_FILTER_COMPUTERS
,
562 DSOP_DOWNLEVEL_FILTER_COMPUTERS
570 InitInfo
.cbSize
= sizeof(InitInfo
);
571 InitInfo
.pwzTargetComputer
= NULL
;
572 InitInfo
.cDsScopeInfos
= sizeof(Scopes
) / sizeof(Scopes
[0]);
573 InitInfo
.aDsScopeInfos
= Scopes
;
574 InitInfo
.flOptions
= DSOP_SCOPE_TYPE_TARGET_COMPUTER
;
575 InitInfo
.cAttributesToFetch
= 0;
576 InitInfo
.apwzAttributeNames
= NULL
;
578 hRet
= (*pDsObjectPicker
)->lpVtbl
->Initialize(*pDsObjectPicker
,
583 /* delete the object picker in case initialization failed! */
584 (*pDsObjectPicker
)->lpVtbl
->Release(*pDsObjectPicker
);
592 InvokeRemoteRegistryPickerDialog(IN IDsObjectPicker
*pDsObjectPicker
,
593 IN HWND hwndParent OPTIONAL
,
597 IDataObject
*pdo
= NULL
;
600 hRet
= pDsObjectPicker
->lpVtbl
->InvokeDialog(pDsObjectPicker
,
608 fe
.cfFormat
= RegisterClipboardFormat(CFSTR_DSOP_DS_SELECTION_LIST
);
610 fe
.dwAspect
= DVASPECT_CONTENT
;
612 fe
.tymed
= TYMED_HGLOBAL
;
614 hRet
= pdo
->lpVtbl
->GetData(pdo
,
619 PDS_SELECTION_LIST SelectionList
= (PDS_SELECTION_LIST
)GlobalLock(stm
.hGlobal
);
620 if (SelectionList
!= NULL
)
622 if (SelectionList
->cItems
== 1)
624 UINT nlen
= wcslen(SelectionList
->aDsSelection
[0].pwzName
);
631 SelectionList
->aDsSelection
[0].pwzName
,
632 nlen
* sizeof(WCHAR
));
633 lpBuffer
[nlen
] = L
'\0';
636 GlobalUnlock(stm
.hGlobal
);
639 ReleaseStgMedium(&stm
);
642 pdo
->lpVtbl
->Release(pdo
);
649 FreeObjectPicker(IN IDsObjectPicker
*pDsObjectPicker
)
651 pDsObjectPicker
->lpVtbl
->Release(pDsObjectPicker
);
654 /*******************************************************************************
656 * FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
658 * PURPOSE: Processes WM_COMMAND messages for the main frame window.
661 static BOOL
_CmdWndProc(HWND hWnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
663 HKEY hKeyRoot
= 0, hKey
= 0;
667 REGSAM regsam
= KEY_READ
;
671 switch (LOWORD(wParam
)) {
672 case ID_REGISTRY_IMPORTREGISTRYFILE
:
673 ImportRegistryFile(hWnd
);
675 case ID_REGISTRY_EXPORTREGISTRYFILE
:
676 ExportRegistryFile(hWnd
);
678 case ID_REGISTRY_CONNECTNETWORKREGISTRY
:
680 IDsObjectPicker
*ObjectPicker
;
681 WCHAR szComputerName
[MAX_COMPUTERNAME_LENGTH
+ 1];
684 hRet
= CoInitialize(NULL
);
687 hRet
= InitializeRemoteRegistryPicker(&ObjectPicker
);
690 hRet
= InvokeRemoteRegistryPickerDialog(ObjectPicker
,
693 sizeof(szComputerName
) / sizeof(szComputerName
[0]));
696 /* FIXME - connect to the registry */
699 FreeObjectPicker(ObjectPicker
);
707 case ID_REGISTRY_DISCONNECTNETWORKREGISTRY
:
709 case ID_REGISTRY_PRINT
:
710 PrintRegistryHive(hWnd
, _T(""));
712 case ID_REGISTRY_EXIT
:
715 case ID_VIEW_STATUSBAR
:
716 toggle_child(hWnd
, LOWORD(wParam
), hStatusBar
);
718 case ID_HELP_HELPTOPICS
:
719 WinHelp(hWnd
, _T("regedit"), HELP_FINDER
, 0);
728 GetClientRect(g_pChildWnd
->hWnd
, &rt
);
729 pt
.x
= rt
.left
+ g_pChildWnd
->nSplitPos
;
730 pt
.y
= (rt
.bottom
/ 2);
732 if(ClientToScreen(g_pChildWnd
->hWnd
, &pts
))
734 SetCursorPos(pts
.x
, pts
.y
);
735 SetCursor(LoadCursor(0, IDC_SIZEWE
));
736 SendMessage(g_pChildWnd
->hWnd
, WM_LBUTTONDOWN
, 0, MAKELPARAM(pt
.x
, pt
.y
));
742 case ID_EDIT_MODIFY_BIN
:
748 keyPath
= GetItemPath(g_pChildWnd
->hTreeWnd
, 0, &hKeyRoot
);
749 valueName
= GetValueName(g_pChildWnd
->hListWnd
, -1);
751 lRet
= RegOpenKeyEx(hKeyRoot
, keyPath
, 0, regsam
, &hKey
);
752 if (lRet
!= ERROR_SUCCESS
) hKey
= 0;
755 switch (LOWORD(wParam
)) {
757 if (valueName
&& ModifyValue(hWnd
, hKey
, valueName
, FALSE
))
758 RefreshListView(g_pChildWnd
->hListWnd
, hKeyRoot
, keyPath
);
760 case ID_EDIT_MODIFY_BIN
:
761 if (valueName
&& ModifyValue(hWnd
, hKey
, valueName
, TRUE
))
762 RefreshListView(g_pChildWnd
->hListWnd
, hKeyRoot
, keyPath
);
765 if(ListView_GetSelectedCount(g_pChildWnd
->hListWnd
) == 1)
767 item
= ListView_GetNextItem(g_pChildWnd
->hListWnd
, -1, LVNI_SELECTED
);
770 ListView_EditLabel(g_pChildWnd
->hListWnd
, item
);
776 UINT nSelected
= ListView_GetSelectedCount(g_pChildWnd
->hListWnd
);
779 TCHAR msg
[128], caption
[128];
780 LoadString(hInst
, IDS_QUERY_DELETE_CONFIRM
, caption
, sizeof(caption
)/sizeof(TCHAR
));
781 LoadString(hInst
, (nSelected
== 1 ? IDS_QUERY_DELETE_ONE
: IDS_QUERY_DELETE_MORE
), msg
, sizeof(msg
)/sizeof(TCHAR
));
782 if(MessageBox(g_pChildWnd
->hWnd
, msg
, caption
, MB_ICONQUESTION
| MB_YESNO
) == IDYES
)
788 while((ni
= ListView_GetNextItem(g_pChildWnd
->hListWnd
, item
, LVNI_SELECTED
)) > -1)
790 valueName
= GetValueName(g_pChildWnd
->hListWnd
, item
);
791 if(RegDeleteValue(hKey
, valueName
) != ERROR_SUCCESS
)
798 RefreshListView(g_pChildWnd
->hListWnd
, hKeyRoot
, keyPath
);
801 LoadString(hInst
, IDS_ERR_DELVAL_CAPTION
, caption
, sizeof(caption
)/sizeof(TCHAR
));
802 LoadString(hInst
, IDS_ERR_DELETEVALUE
, msg
, sizeof(msg
)/sizeof(TCHAR
));
803 MessageBox(g_pChildWnd
->hWnd
, msg
, caption
, MB_ICONSTOP
);
808 case ID_EDIT_NEW_STRINGVALUE
:
809 CreateNewValue(hKeyRoot
, keyPath
, REG_SZ
);
811 case ID_EDIT_NEW_BINARYVALUE
:
812 CreateNewValue(hKeyRoot
, keyPath
, REG_BINARY
);
814 case ID_EDIT_NEW_DWORDVALUE
:
815 CreateNewValue(hKeyRoot
, keyPath
, REG_DWORD
);
818 case ID_EDIT_COPYKEYNAME
:
819 CopyKeyName(hWnd
, _T(""));
821 case ID_EDIT_PERMISSIONS
:
822 if(keyPath
!= NULL
&& _tcslen(keyPath
) > 0)
824 RegKeyEditPermissions(hWnd
, hKey
, NULL
, keyPath
);
828 MessageBeep(MB_ICONASTERISK
);
831 case ID_REGISTRY_PRINTERSETUP
:
834 /*PAGESETUPDLG psd;*/
835 /*PageSetupDlg(&psd);*/
837 case ID_REGISTRY_OPENLOCAL
:
840 case ID_VIEW_REFRESH
:
841 RefreshTreeView(g_pChildWnd
->hTreeWnd
);
842 /*RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath, NULL); */
844 /*case ID_OPTIONS_TOOLBAR:*/
845 /* toggle_child(hWnd, LOWORD(wParam), hToolBar);*/
847 case ID_EDIT_NEW_KEY
:
848 CreateNewKey(g_pChildWnd
->hTreeWnd
, TreeView_GetSelection(g_pChildWnd
->hTreeWnd
));
859 /********************************************************************************
861 * FUNCTION: FrameWndProc(HWND, unsigned, WORD, LONG)
863 * PURPOSE: Processes messages for the main frame window.
865 * WM_COMMAND - process the application menu
866 * WM_DESTROY - post a quit message and return
870 LRESULT CALLBACK
FrameWndProc(HWND hWnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
874 CreateWindowEx(0, szChildClass
, NULL
, WS_CHILD
| WS_VISIBLE
,
875 CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
,
876 hWnd
, (HMENU
)0, hInst
, 0);
879 if (!_CmdWndProc(hWnd
, message
, wParam
, lParam
))
880 return DefWindowProc(hWnd
, message
, wParam
, lParam
);
884 SetFocus(g_pChildWnd
->hWnd
);
887 resize_frame_client(hWnd
);
891 case WM_ENTERMENULOOP
:
892 OnEnterMenuLoop(hWnd
);
894 case WM_EXITMENULOOP
:
895 OnExitMenuLoop(hWnd
);
898 OnMenuSelect(hWnd
, LOWORD(wParam
), HIWORD(wParam
), (HMENU
)lParam
);
901 WinHelp(hWnd
, _T("regedit"), HELP_QUIT
, 0);
904 return DefWindowProc(hWnd
, message
, wParam
, lParam
);