Author Topic: CreateWindowEx  (Read 3452 times)

shankle

  • Member
  • ****
  • Posts: 857
CreateWindowEx
« 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.

TouEnMasm

  • Member
  • *****
  • Posts: 1337
    • EditMasm
Re: CreateWindowEx
« Reply #1 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
);

Fa is a musical note to play with CL

wjr

  • Member
  • **
  • Posts: 217
    • WJR's website
Re: CreateWindowEx
« Reply #2 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.

shankle

  • Member
  • ****
  • Posts: 857
Re: CreateWindowEx
« Reply #3 on: November 03, 2014, 08:58:29 AM »
Please disregard my previous zip file as it has been revised.

wjr

  • Member
  • **
  • Posts: 217
    • WJR's website
Re: CreateWindowEx
« Reply #4 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).