The MASM Forum

Projects => Rarely Used Projects => GoAsm => Topic started by: shankle on November 03, 2014, 02:20:46 AM

Title: CreateWindowEx
Post by: shankle on November 03, 2014, 02:20:46 AM
Having a tad of trouble with CreateWindowEx.
Please see the attached zip file.
Thanks for any help.
Title: Re: CreateWindowEx
Post by: TouEnMasm on November 03, 2014, 04:48:57 AM

I am not a user of radasm,but..
 There is no window created in your code
 There is no classname registered in the function
Quote
HWND CreateWindowEx(          DWORD dwExStyle,
    LPCTSTR lpClassName,       ;registered name or windows defined class name (ex:BUTTON)
    LPCTSTR lpWindowName,
    DWORD dwStyle,
    int x,
    int y,
    int nWidth,
    int nHeight,
    HWND hWndParent,
    HMENU hMenu,
    HINSTANCE hInstance,
    LPVOID lpParam
);

Title: Re: CreateWindowEx
Post by: wjr on November 03, 2014, 05:31:17 AM
After the call to LoadMenu save rax to [hMenu] since rax isn't preserved across the future invokes.
Title: Re: CreateWindowEx
Post by: shankle on November 03, 2014, 08:58:29 AM
Please disregard my previous zip file as it has been revised.
Title: Re: CreateWindowEx
Post by: wjr on November 03, 2014, 09:52:48 AM
If you are not doing anything fancy with the menu, it is easier to put menu ID 600 with the lpszMenuName for your call to RegisterClassEx, and NULL for hMenu in CreateWindowEx. You can then drop the LoadMenu and SetMenu calls (use GetMenu if handle needed later).

The call to SetMenu doesn't have a valid [hWnd] since the window hasn't been created yet, and that call isn't needed anyways if you use [hMenu] in CreateWindowEx (if you use NULL here, then SetMenu goes after).