[Sorry for bad title, couldn't think of anything better]
I have this code:
;in data section
title du 'XM Player'
.len = $-title
dw 0
;...
class du 'PLAYERPLAYERPLAYERPLAYER',0
;...
wc WNDCLASS CS_BYTEALIGNCLIENT+CS_BYTEALIGNWINDOW+CS_HREDRAW+CS_SAVEBITS+\
CS_VREDRAW,WindowProc,0,0,0,0,0,0,0,class
;...
.orange = wc.hbrBackground
;and in code section:
invoke GetModuleHandle,NULL
mov [wc.hInstance],eax
;...
invoke CreateSolidBrush,0045AEFFh
mov [brushes.orange],eax
;...
invoke LoadIcon,NULL,IDI_APPLICATION
mov [wc.hIcon],eax
invoke LoadCursor,NULL,IDC_ARROW
mov [wc.hCursor],eax
invoke RegisterClass,wc
test eax,eax
jz .error
invoke MessageBox,NULL,'RegisterClass didn''t mess up','AAAAAAA',MB_ICONQUESTION
stdcall GetFirstArg,argc
invoke CreateWindowEx,WS_EX_ACCEPTFILES+WS_EX_APPWINDOW,class,title,\
WS_POPUP+WS_VISIBLE,CW_USEDEFAULT,CW_USEDEFAULT,137,80,NULL,\
NULL,[wc.hInstance],eax
test eax,eax
jz .error
For some reason, CreateWindowEx fails, returning 0, yet the error code is ERROR_SUCCESS. Could someone find the fault with this code? (BTW, I have also tried redefining CW_USEDEFAULT to 0x80000000, which is what it is in WinUser.H, but it didn't help.
BTW, CreateWindowEx and RegisterClass are Unicode (CreateWindowExW etc.)