Alexandre Julliard : regedit: Remove unnecessary use of class atoms.

Alexandre Julliard julliard at winehq.org
Mon Apr 18 11:10:55 CDT 2011


Module: wine
Branch: master
Commit: dcc9c37e979321b3d7f02efd22299fc6a9106e31
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=dcc9c37e979321b3d7f02efd22299fc6a9106e31

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Apr 18 12:08:31 2011 +0200

regedit: Remove unnecessary use of class atoms.

---

 programs/regedit/main.c |   31 +++++++------------------------
 1 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/programs/regedit/main.c b/programs/regedit/main.c
index b055d7b..d764702 100644
--- a/programs/regedit/main.c
+++ b/programs/regedit/main.c
@@ -63,8 +63,9 @@ WCHAR szTitle[MAX_LOADSTRING];
 const WCHAR szFrameClass[] = {'R','E','G','E','D','I','T','_','F','R','A','M','E',0};
 const WCHAR szChildClass[] = {'R','E','G','E','D','I','T',0};
 
-static BOOL RegisterWindowClasses(HINSTANCE hInstance, ATOM *hFrameWndClass, ATOM *hChildWndClass)
+static BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
 {
+    WCHAR empty = 0;
     WNDCLASSEXW wndclass = {0};
 
     /* Frame class */
@@ -75,33 +76,15 @@ static BOOL RegisterWindowClasses(HINSTANCE hInstance, ATOM *hFrameWndClass, ATO
     wndclass.hIcon = LoadIconW(hInstance, MAKEINTRESOURCEW(IDI_REGEDIT));
     wndclass.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
     wndclass.lpszClassName = szFrameClass;
-    wndclass.hIconSm = LoadImageW(hInstance, MAKEINTRESOURCEW(IDI_REGEDIT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
-                                  GetSystemMetrics(SM_CYSMICON), LR_SHARED);
-
-    if (!(*hFrameWndClass = RegisterClassExW(&wndclass)))
-        return FALSE;
+    wndclass.hIconSm = LoadImageW(hInstance, MAKEINTRESOURCEW(IDI_REGEDIT), IMAGE_ICON,
+                                  GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
+    RegisterClassExW(&wndclass);
 
     /* Child class */
     wndclass.lpfnWndProc = ChildWndProc;
     wndclass.cbWndExtra = sizeof(HANDLE);
     wndclass.lpszClassName = szChildClass;
-
-    if (!(*hChildWndClass = RegisterClassExW(&wndclass)))
-    {
-        UnregisterClassW(szFrameClass, hInstance);
-        return FALSE;
-    }
-
-    return TRUE;
-}
-
-static BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
-{
-    WCHAR empty = 0;
-    ATOM hFrameWndClass, hChildWndClass;
-
-    if (!RegisterWindowClasses(hInstance, &hFrameWndClass, &hChildWndClass))
-        return FALSE;
+    RegisterClassExW(&wndclass);
 
     hMenuFrame = LoadMenuW(hInstance, MAKEINTRESOURCEW(IDR_REGEDIT_MENU));
     hPopupMenus = LoadMenuW(hInstance, MAKEINTRESOURCEW(IDR_POPUP_MENUS));
@@ -114,7 +97,7 @@ static BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
 
     nClipboardFormat = RegisterClipboardFormatW(strClipboardFormat);
 
-    hFrameWnd = CreateWindowExW(0, MAKEINTRESOURCEW(hFrameWndClass), szTitle,
+    hFrameWnd = CreateWindowExW(0, szFrameClass, szTitle,
                                 WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE,
                                 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                                 NULL, hMenuFrame, hInstance, NULL/*lpParam*/);




More information about the wine-cvs mailing list