News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

CreateWindowEx

Started by shankle, November 03, 2014, 02:20:46 AM

Previous topic - Next topic

shankle

Having a tad of trouble with CreateWindowEx.
Please see the attached zip file.
Thanks for any help.

TouEnMasm


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
);

Fa is a musical note to play with CL

wjr

After the call to LoadMenu save rax to [hMenu] since rax isn't preserved across the future invokes.

shankle

Please disregard my previous zip file as it has been revised.

wjr

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).