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
34 /********************************************************************************
35 * Global and Local Variables:
38 static BOOL bInMenuLoop
= FALSE
; /* Tells us if we are in the menu loop */
40 /*******************************************************************************
41 * Local module support methods
44 static void resize_frame_rect(HWND hWnd
, PRECT prect
)
48 if (IsWindowVisible(hToolBar)) {
49 SendMessage(hToolBar, WM_SIZE, 0, 0);
50 GetClientRect(hToolBar, &rt);
51 prect->top = rt.bottom+3;
52 prect->bottom -= rt.bottom+3;
55 if (IsWindowVisible(hStatusBar
)) {
56 SetupStatusBar(hWnd
, TRUE
);
57 GetClientRect(hStatusBar
, &rt
);
58 prect
->bottom
-= rt
.bottom
;
60 MoveWindow(g_pChildWnd
->hWnd
, prect
->left
, prect
->top
, prect
->right
, prect
->bottom
, TRUE
);
63 static void resize_frame_client(HWND hWnd
)
67 GetClientRect(hWnd
, &rect
);
68 resize_frame_rect(hWnd
, &rect
);
71 /********************************************************************************/
73 static void OnEnterMenuLoop(HWND hWnd
)
77 /* Update the status bar pane sizes */
79 SendMessage(hStatusBar
, SB_SETPARTS
, 1, (LPARAM
)&nParts
);
81 SendMessage(hStatusBar
, SB_SETTEXT
, (WPARAM
)0, (LPARAM
)_T(""));
84 static void OnExitMenuLoop(HWND hWnd
)
87 /* Update the status bar pane sizes*/
88 SetupStatusBar(hWnd
, TRUE
);
92 static void OnMenuSelect(HWND hWnd
, UINT nItemID
, UINT nFlags
, HMENU hSysMenu
)
97 if (nFlags
& MF_POPUP
) {
98 if (hSysMenu
!= GetMenu(hWnd
)) {
99 if (nItemID
== 2) nItemID
= 5;
102 if (LoadString(hInst
, nItemID
, str
, 100)) {
103 /* load appropriate string*/
105 /* first newline terminates actual string*/
106 lpsz
= _tcschr(lpsz
, '\n');
110 SendMessage(hStatusBar
, SB_SETTEXT
, 0, (LPARAM
)str
);
113 void SetupStatusBar(HWND hWnd
, BOOL bResize
)
117 GetClientRect(hWnd
, &rc
);
121 SendMessage(hStatusBar
, WM_SIZE
, 0, 0);
122 SendMessage(hStatusBar
, SB_SETPARTS
, 1, (LPARAM
)&nParts
);
125 void UpdateStatusBar(void)
130 size
= sizeof(text
)/sizeof(TCHAR
);
131 GetComputerName(text
, &size
);
132 SendMessage(hStatusBar
, SB_SETTEXT
, 0, (LPARAM
)text
);
135 static void toggle_child(HWND hWnd
, UINT cmd
, HWND hchild
)
137 BOOL vis
= IsWindowVisible(hchild
);
138 HMENU hMenuView
= GetSubMenu(hMenuFrame
, ID_VIEW_MENU
);
140 CheckMenuItem(hMenuView
, cmd
, vis
?MF_BYCOMMAND
:MF_BYCOMMAND
|MF_CHECKED
);
141 ShowWindow(hchild
, vis
?SW_HIDE
:SW_SHOW
);
142 resize_frame_client(hWnd
);
145 static BOOL
CheckCommDlgError(HWND hWnd
)
147 DWORD dwErrorCode
= CommDlgExtendedError();
148 switch (dwErrorCode
) {
149 case CDERR_DIALOGFAILURE
:
151 case CDERR_FINDRESFAILURE
:
153 case CDERR_NOHINSTANCE
:
155 case CDERR_INITIALIZATION
:
159 case CDERR_LOCKRESFAILURE
:
161 case CDERR_NOTEMPLATE
:
163 case CDERR_LOADRESFAILURE
:
165 case CDERR_STRUCTSIZE
:
167 case CDERR_LOADSTRFAILURE
:
169 case FNERR_BUFFERTOOSMALL
:
171 case CDERR_MEMALLOCFAILURE
:
173 case FNERR_INVALIDFILENAME
:
175 case CDERR_MEMLOCKFAILURE
:
177 case FNERR_SUBCLASSFAILURE
:
185 #define MAX_CUSTOM_FILTER_SIZE 50
186 TCHAR CustomFilterBuffer
[MAX_CUSTOM_FILTER_SIZE
];
187 TCHAR FileNameBuffer
[_MAX_PATH
];
188 TCHAR FileTitleBuffer
[_MAX_PATH
];
194 } FILTERPAIR
, *PFILTERPAIR
;
197 BuildFilterStrings(TCHAR
*Filter
, PFILTERPAIR Pairs
, int PairCount
)
202 for(i
= 0; i
< PairCount
; i
++)
204 c
+= LoadString(hInst
, Pairs
[i
].DisplayID
, &Filter
[c
], 255 * sizeof(TCHAR
));
206 c
+= LoadString(hInst
, Pairs
[i
].FilterID
, &Filter
[c
], 255 * sizeof(TCHAR
));
212 static BOOL
InitOpenFileName(HWND hWnd
, OPENFILENAME
* pofn
)
214 FILTERPAIR FilterPairs
[3];
215 static TCHAR Filter
[1024];
217 memset(pofn
, 0, sizeof(OPENFILENAME
));
218 pofn
->lStructSize
= sizeof(OPENFILENAME
);
219 pofn
->hwndOwner
= hWnd
;
220 pofn
->hInstance
= hInst
;
222 /* create filter string */
223 FilterPairs
[0].DisplayID
= IDS_FLT_REGFILES
;
224 FilterPairs
[0].FilterID
= IDS_FLT_REGFILES_FLT
;
225 FilterPairs
[1].DisplayID
= IDS_FLT_REGEDIT4
;
226 FilterPairs
[1].FilterID
= IDS_FLT_REGEDIT4_FLT
;
227 FilterPairs
[2].DisplayID
= IDS_FLT_ALLFILES
;
228 FilterPairs
[2].FilterID
= IDS_FLT_ALLFILES_FLT
;
229 BuildFilterStrings(Filter
, FilterPairs
, sizeof(FilterPairs
) / sizeof(FILTERPAIR
));
231 pofn
->lpstrFilter
= Filter
;
232 pofn
->lpstrCustomFilter
= CustomFilterBuffer
;
233 pofn
->nMaxCustFilter
= MAX_CUSTOM_FILTER_SIZE
;
234 pofn
->nFilterIndex
= 0;
235 pofn
->lpstrFile
= FileNameBuffer
;
236 pofn
->nMaxFile
= _MAX_PATH
;
237 pofn
->lpstrFileTitle
= FileTitleBuffer
;
238 pofn
->nMaxFileTitle
= _MAX_PATH
;
239 /* pofn->lpstrInitialDir = _T("");*/
240 /* pofn->lpstrTitle = _T("Import Registry File");*/
241 /* pofn->Flags = OFN_ENABLETEMPLATE + OFN_EXPLORER + OFN_ENABLESIZING;*/
242 pofn
->Flags
= OFN_HIDEREADONLY
;
243 /* pofn->nFileOffset = ;*/
244 /* pofn->nFileExtension = ;*/
245 /* pofn->lpstrDefExt = _T("");*/
246 /* pofn->lCustData = ;*/
247 /* pofn->lpfnHook = ImportRegistryFile_OFNHookProc;*/
248 /* pofn->lpTemplateName = _T("ID_DLG_IMPORT_REGFILE");*/
249 /* pofn->lpTemplateName = MAKEINTRESOURCE(IDD_DIALOG1);*/
250 /* pofn->FlagsEx = ;*/
254 static BOOL
ImportRegistryFile(HWND hWnd
)
259 InitOpenFileName(hWnd
, &ofn
);
260 LoadString(hInst
, IDS_IMPORT_REG_FILE
, Caption
, sizeof(Caption
)/sizeof(TCHAR
));
261 ofn
.lpstrTitle
= Caption
;
262 /* ofn.lCustData = ;*/
263 if (GetOpenFileName(&ofn
)) {
264 /* FIXME - convert to ascii */
265 if (!import_registry_file((LPSTR
)ofn
.lpstrFile
)) {
266 /*printf("Can't open file \"%s\"\n", ofn.lpstrFile);*/
270 get_file_name(&s
, filename
, MAX_PATH
);
272 printf("No file name is specified\n%s", usage
);
276 while (filename
[0]) {
277 if (!import_registry_file(filename
)) {
279 printf("Can't open file \"%s\"\n", filename
);
283 get_file_name(&s
, filename
, MAX_PATH
);
288 CheckCommDlgError(hWnd
);
294 static UINT_PTR CALLBACK
ExportRegistryFile_OFNHookProc(HWND hdlg
, UINT uiMsg
, WPARAM wParam
, LPARAM lParam
)
297 UINT_PTR iResult
= 0;
301 hControl
= GetDlgItem(hdlg
, IDC_EXPORT_ALL
);
304 EnableWindow(hControl
, FALSE
);
305 SendMessage(hControl
, BM_SETCHECK
, BST_CHECKED
, 0);
308 hControl
= GetDlgItem(hdlg
, IDC_EXPORT_BRANCH
);
311 EnableWindow(hControl
, FALSE
);
312 SendMessage(hControl
, BM_SETCHECK
, BST_UNCHECKED
, 0);
315 hControl
= GetDlgItem(hdlg
, IDC_EXPORT_BRANCH_TEXT
);
318 EnableWindow(hControl
, FALSE
);
325 static BOOL
ExportRegistryFile(HWND hWnd
)
328 TCHAR ExportKeyPath
[_MAX_PATH
];
331 ExportKeyPath
[0] = _T('\0');
332 InitOpenFileName(hWnd
, &ofn
);
333 LoadString(hInst
, IDS_EXPORT_REG_FILE
, Caption
, sizeof(Caption
)/sizeof(TCHAR
));
334 ofn
.lpstrTitle
= Caption
;
335 /* ofn.lCustData = ;*/
336 ofn
.Flags
= OFN_ENABLETEMPLATE
| OFN_EXPLORER
| OFN_ENABLEHOOK
;
337 ofn
.lpfnHook
= ExportRegistryFile_OFNHookProc
;
338 ofn
.lpTemplateName
= MAKEINTRESOURCE(IDD_EXPORTRANGE
);
339 if (GetSaveFileName(&ofn
)) {
341 /* FIXME - convert strings to ascii! */
342 result
= export_registry_key((CHAR
*)ofn
.lpstrFile
, (CHAR
*)ExportKeyPath
);
343 /*result = export_registry_key(ofn.lpstrFile, NULL);*/
344 /*if (!export_registry_key(ofn.lpstrFile, NULL)) {*/
346 /*printf("Can't open file \"%s\"\n", ofn.lpstrFile);*/
350 TCHAR filename
[MAX_PATH
];
352 get_file_name(&s
, filename
, MAX_PATH
);
354 printf("No file name is specified\n%s", usage
);
359 TCHAR reg_key_name
[KEY_MAX_LEN
];
360 get_file_name(&s
, reg_key_name
, KEY_MAX_LEN
);
361 export_registry_key((CHAR
)filename
, reg_key_name
);
363 export_registry_key(filename
, NULL
);
368 CheckCommDlgError(hWnd
);
373 BOOL
PrintRegistryHive(HWND hWnd
, LPTSTR path
)
378 ZeroMemory(&pd
, sizeof(PRINTDLG
));
379 pd
.lStructSize
= sizeof(PRINTDLG
);
381 pd
.hDevMode
= NULL
; /* Don't forget to free or store hDevMode*/
382 pd
.hDevNames
= NULL
; /* Don't forget to free or store hDevNames*/
383 pd
.Flags
= PD_USEDEVMODECOPIESANDCOLLATE
| PD_RETURNDC
;
385 pd
.nFromPage
= 0xFFFF;
388 pd
.nMaxPage
= 0xFFFF;
390 /* GDI calls to render output. */
391 DeleteDC(pd
.hDC
); /* Delete DC when done.*/
397 hResult
= PrintDlgEx(&pd
);
398 if (hResult
== S_OK
) {
399 switch (pd
.dwResultAction
) {
400 case PD_RESULT_APPLY
:
401 /*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. */
403 case PD_RESULT_CANCEL
:
404 /*The user clicked the Cancel button. The information in the PRINTDLGEX structure is unchanged. */
406 case PD_RESULT_PRINT
:
407 /*The user clicked the Print button. The PRINTDLGEX structure contains the information specified by the user. */
415 /*Insufficient memory. */
418 /* One or more arguments are invalid. */
421 /*Invalid pointer. */
427 /*Unspecified error. */
438 static BOOL
CopyKeyName(HWND hWnd
, LPCTSTR keyName
)
442 result
= OpenClipboard(hWnd
);
444 result
= EmptyClipboard();
447 /*HANDLE hClipData;*/
448 /*hClipData = SetClipboardData(UINT uFormat, HANDLE hMem);*/
451 /* error emptying clipboard*/
452 /* DWORD dwError = GetLastError(); */
455 if (!CloseClipboard()) {
456 /* error closing clipboard*/
457 /* DWORD dwError = GetLastError(); */
461 /* error opening clipboard*/
462 /* DWORD dwError = GetLastError(); */
468 static BOOL
CreateNewValue(HKEY hRootKey
, LPCTSTR pszKeyPath
, DWORD dwType
)
470 TCHAR szNewValueFormat
[128];
471 TCHAR szNewValue
[128];
474 DWORD dwExistingType
, cbData
;
479 if (RegOpenKey(hRootKey
, pszKeyPath
, &hKey
) != ERROR_SUCCESS
)
482 LoadString(hInst
, IDS_NEW_VALUE
, szNewValueFormat
, sizeof(szNewValueFormat
)
483 / sizeof(szNewValueFormat
[0]));
487 _sntprintf(szNewValue
, sizeof(szNewValue
) / sizeof(szNewValue
[0]),
488 szNewValueFormat
, iIndex
++);
490 cbData
= sizeof(data
);
491 lResult
= RegQueryValueEx(hKey
, szNewValue
, NULL
, &dwExistingType
, data
, &cbData
);
493 while(lResult
== ERROR_SUCCESS
);
497 cbData
= sizeof(DWORD
);
501 cbData
= sizeof(TCHAR
);
504 cbData
= sizeof(TCHAR
) * 2;
507 cbData
= sizeof(DWORD
) * 2;
513 memset(data
, 0, cbData
);
514 lResult
= RegSetValueEx(hKey
, szNewValue
, 0, dwType
, data
, cbData
);
515 if (lResult
!= ERROR_SUCCESS
)
518 RefreshListView(g_pChildWnd
->hListWnd
, hRootKey
, pszKeyPath
);
520 /* locate the newly added value, and get ready to rename it */
521 memset(&lvfi
, 0, sizeof(lvfi
));
522 lvfi
.flags
= LVFI_STRING
;
523 lvfi
.psz
= szNewValue
;
524 iIndex
= ListView_FindItem(g_pChildWnd
->hListWnd
, -1, &lvfi
);
526 ListView_EditLabel(g_pChildWnd
->hListWnd
, iIndex
);
532 InitializeRemoteRegistryPicker(OUT IDsObjectPicker
**pDsObjectPicker
)
536 *pDsObjectPicker
= NULL
;
538 hRet
= CoCreateInstance(&CLSID_DsObjectPicker
,
540 CLSCTX_INPROC_SERVER
,
541 &IID_IDsObjectPicker
,
542 (LPVOID
*)pDsObjectPicker
);
545 DSOP_INIT_INFO InitInfo
;
546 DSOP_SCOPE_INIT_INFO Scopes
[] =
549 sizeof(DSOP_SCOPE_INIT_INFO
),
550 DSOP_SCOPE_TYPE_USER_ENTERED_UPLEVEL_SCOPE
| DSOP_SCOPE_TYPE_USER_ENTERED_DOWNLEVEL_SCOPE
|
551 DSOP_SCOPE_TYPE_GLOBAL_CATALOG
| DSOP_SCOPE_TYPE_EXTERNAL_UPLEVEL_DOMAIN
|
552 DSOP_SCOPE_TYPE_EXTERNAL_DOWNLEVEL_DOMAIN
| DSOP_SCOPE_TYPE_WORKGROUP
|
553 DSOP_SCOPE_TYPE_UPLEVEL_JOINED_DOMAIN
| DSOP_SCOPE_TYPE_DOWNLEVEL_JOINED_DOMAIN
,
557 DSOP_FILTER_COMPUTERS
,
561 DSOP_DOWNLEVEL_FILTER_COMPUTERS
|
562 DSOP_DOWNLEVEL_FILTER_GLOBAL_GROUPS
| DSOP_DOWNLEVEL_FILTER_ALL_WELLKNOWN_SIDS
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
= InitializeRemoteRegistryPicker(&ObjectPicker
);
687 hRet
= InvokeRemoteRegistryPickerDialog(ObjectPicker
,
690 sizeof(szComputerName
) / sizeof(szComputerName
[0]));
693 /* FIXME - connect to the registry */
696 FreeObjectPicker(ObjectPicker
);
701 case ID_REGISTRY_DISCONNECTNETWORKREGISTRY
:
703 case ID_REGISTRY_PRINT
:
704 PrintRegistryHive(hWnd
, _T(""));
706 case ID_REGISTRY_EXIT
:
709 case ID_VIEW_STATUSBAR
:
710 toggle_child(hWnd
, LOWORD(wParam
), hStatusBar
);
712 case ID_HELP_HELPTOPICS
:
713 WinHelp(hWnd
, _T("regedit"), HELP_FINDER
, 0);
722 GetClientRect(g_pChildWnd
->hWnd
, &rt
);
723 pt
.x
= rt
.left
+ g_pChildWnd
->nSplitPos
;
724 pt
.y
= (rt
.bottom
/ 2);
726 if(ClientToScreen(g_pChildWnd
->hWnd
, &pts
))
728 SetCursorPos(pts
.x
, pts
.y
);
729 SetCursor(LoadCursor(0, IDC_SIZEWE
));
730 SendMessage(g_pChildWnd
->hWnd
, WM_LBUTTONDOWN
, 0, MAKELPARAM(pt
.x
, pt
.y
));
736 case ID_EDIT_MODIFY_BIN
:
742 keyPath
= GetItemPath(g_pChildWnd
->hTreeWnd
, 0, &hKeyRoot
);
743 valueName
= GetValueName(g_pChildWnd
->hListWnd
, -1);
745 lRet
= RegOpenKeyEx(hKeyRoot
, keyPath
, 0, regsam
, &hKey
);
746 if (lRet
!= ERROR_SUCCESS
) hKey
= 0;
749 switch (LOWORD(wParam
)) {
751 if (valueName
&& ModifyValue(hWnd
, hKey
, valueName
, FALSE
))
752 RefreshListView(g_pChildWnd
->hListWnd
, hKeyRoot
, keyPath
);
754 case ID_EDIT_MODIFY_BIN
:
755 if (valueName
&& ModifyValue(hWnd
, hKey
, valueName
, TRUE
))
756 RefreshListView(g_pChildWnd
->hListWnd
, hKeyRoot
, keyPath
);
759 if(ListView_GetSelectedCount(g_pChildWnd
->hListWnd
) == 1)
761 item
= ListView_GetNextItem(g_pChildWnd
->hListWnd
, -1, LVNI_SELECTED
);
764 ListView_EditLabel(g_pChildWnd
->hListWnd
, item
);
770 UINT nSelected
= ListView_GetSelectedCount(g_pChildWnd
->hListWnd
);
773 TCHAR msg
[128], caption
[128];
774 LoadString(hInst
, IDS_QUERY_DELETE_CONFIRM
, caption
, sizeof(caption
)/sizeof(TCHAR
));
775 LoadString(hInst
, (nSelected
== 1 ? IDS_QUERY_DELETE_ONE
: IDS_QUERY_DELETE_MORE
), msg
, sizeof(msg
)/sizeof(TCHAR
));
776 if(MessageBox(g_pChildWnd
->hWnd
, msg
, caption
, MB_ICONQUESTION
| MB_YESNO
) == IDYES
)
782 while((ni
= ListView_GetNextItem(g_pChildWnd
->hListWnd
, item
, LVNI_SELECTED
)) > -1)
784 valueName
= GetValueName(g_pChildWnd
->hListWnd
, item
);
785 if(RegDeleteValue(hKey
, valueName
) != ERROR_SUCCESS
)
792 RefreshListView(g_pChildWnd
->hListWnd
, hKeyRoot
, keyPath
);
795 LoadString(hInst
, IDS_ERR_DELVAL_CAPTION
, caption
, sizeof(caption
)/sizeof(TCHAR
));
796 LoadString(hInst
, IDS_ERR_DELETEVALUE
, msg
, sizeof(msg
)/sizeof(TCHAR
));
797 MessageBox(g_pChildWnd
->hWnd
, msg
, caption
, MB_ICONSTOP
);
802 case ID_EDIT_NEW_STRINGVALUE
:
803 CreateNewValue(hKeyRoot
, keyPath
, REG_SZ
);
805 case ID_EDIT_NEW_BINARYVALUE
:
806 CreateNewValue(hKeyRoot
, keyPath
, REG_BINARY
);
808 case ID_EDIT_NEW_DWORDVALUE
:
809 CreateNewValue(hKeyRoot
, keyPath
, REG_DWORD
);
812 case ID_EDIT_COPYKEYNAME
:
813 CopyKeyName(hWnd
, _T(""));
815 case ID_EDIT_PERMISSIONS
:
816 if(keyPath
!= NULL
&& _tcslen(keyPath
) > 0)
818 RegKeyEditPermissions(hWnd
, hKey
, NULL
, keyPath
);
822 MessageBeep(MB_ICONASTERISK
);
825 case ID_REGISTRY_PRINTERSETUP
:
828 /*PAGESETUPDLG psd;*/
829 /*PageSetupDlg(&psd);*/
831 case ID_REGISTRY_OPENLOCAL
:
834 case ID_VIEW_REFRESH
:
835 RefreshTreeView(g_pChildWnd
->hTreeWnd
);
836 /*RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath, NULL); */
838 /*case ID_OPTIONS_TOOLBAR:*/
839 /* toggle_child(hWnd, LOWORD(wParam), hToolBar);*/
841 case ID_EDIT_NEW_KEY
:
842 CreateNewKey(g_pChildWnd
->hTreeWnd
, TreeView_GetSelection(g_pChildWnd
->hTreeWnd
));
853 /********************************************************************************
855 * FUNCTION: FrameWndProc(HWND, unsigned, WORD, LONG)
857 * PURPOSE: Processes messages for the main frame window.
859 * WM_COMMAND - process the application menu
860 * WM_DESTROY - post a quit message and return
864 LRESULT CALLBACK
FrameWndProc(HWND hWnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
868 CreateWindowEx(0, szChildClass
, NULL
, WS_CHILD
| WS_VISIBLE
,
869 CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
,
870 hWnd
, (HMENU
)0, hInst
, 0);
873 if (!_CmdWndProc(hWnd
, message
, wParam
, lParam
))
874 return DefWindowProc(hWnd
, message
, wParam
, lParam
);
878 SetFocus(g_pChildWnd
->hWnd
);
881 resize_frame_client(hWnd
);
885 case WM_ENTERMENULOOP
:
886 OnEnterMenuLoop(hWnd
);
888 case WM_EXITMENULOOP
:
889 OnExitMenuLoop(hWnd
);
892 OnMenuSelect(hWnd
, LOWORD(wParam
), HIWORD(wParam
), (HMENU
)lParam
);
895 WinHelp(hWnd
, _T("regedit"), HELP_QUIT
, 0);
898 return DefWindowProc(hWnd
, message
, wParam
, lParam
);