I am trying again with this window.
Below is the listing for the program. When I assemble it for 32bit (/x86 in the batch file) it shows up on screen. When assembling for 64 bit (/x64) with the two d type indicators (for wc.hbrBackground and wc.lpszMenuName ) changed to q it assembles and build the executable file. The window never shows and the program needs to be stopped by stopping the process. Right after RegisterClass I have GetClassInfo which fails. On my PC the message is "Class does not exist" The RegisterClass function executes successfully.
Please help.
#define LINKFILES
#include c:\goasm\headers\windows.h
; --------------------------------------------------------
DATA SECTION
ALIGN 8
hinst dq 0
ptrCmdLine dq 0
hButton0 dq 0
hEdit0 dq 0
idButton0 dq 5001
idEdit0 dq 6001
szClassName db "SarelKlas",0
szDisplayName db "Hallo Sarel",0
szButtonClass db "BUTTON",0
szEditClass db "EDIT",0
; --------------------------------------------------------
CODE SECTION
START:
ALIGN 8
INVOKE GetModuleHandle,0
mov [hinst],RAX
invoke GetCommandLine
mov [ptrCmdLine],rax
invoke WinMain,[hinst],0,rax,SW_SHOW
invoke ExitProcess,rax
; --------------------------------------------------------
WinMain frame hInst, hPrevInst, CmdLine, CmdShow
LOCAL wc:WNDCLASS
LOCAL sc:WNDCLASS
LOCAL msg:MSG
LOCAL hWnd:q
LOCAL Temp:q
invoke SetLastError,0
mov D[wc.style],CS_HREDRAW or CS_VREDRAW or CS_BYTEALIGNWINDOW
mov rax,addr WndProc
mov [wc.lpfnWndProc],rax
mov D[wc.cbClsExtra],0
mov D[wc.cbWndExtra],0
mov rax,[hInst]
mov [wc.hInstance],rax
invoke LoadIcon,0,IDI_APPLICATION
mov [wc.hIcon],rax
invoke LoadCursor,0,IDC_ARROW
mov [wc.hCursor],rax
mov d[wc.hbrBackground],COLOR_WINDOW+1
mov d[wc.lpszMenuName],0
mov rax,addr szClassName
mov [wc.lpszClassName],rax
invoke RegisterClass,addr wc ;address of the class structure to register
mov [Temp],rax
invoke GetClassInfo,[hInst],addr szClassName,addr sc
cmp rax,0
jne > Over0
;invoke MessageBox, NULL, 'GetClassInfo failed', 'ERROR', MB_OK
invoke GetLastError
sub esp,512
xor ecx,ecx
mov edx,esp
invoke FormatMessage,FORMAT_MESSAGE_FROM_SYSTEM,ecx,eax,ecx,edx,512,ecx
mov edx,esp
xor ecx,ecx
invoke MessageBox,ecx,edx,ecx,ecx
add esp,512
invoke ExitProcess,0
Over0:
invoke CreateWindow,addr szClassName,addr szDisplayName,\
WS_OVERLAPPEDWINDOW or WS_VISIBLE,\
20,20,500,400,\
0,0,\
[hInst],0
mov [hWnd],rax
cmp rax,0
jne > Over1
;invoke MessageBox, NULL, 'CreateWindowEx failed', 'ERROR', MB_OK
invoke GetLastError
sub esp,512
xor ecx,ecx
mov edx,esp
invoke FormatMessage,FORMAT_MESSAGE_FROM_SYSTEM,ecx,eax,ecx,edx,512,ecx
mov edx,esp
xor ecx,ecx
invoke MessageBox,ecx,edx,ecx,ecx
add esp,512
invoke ExitProcess,0
Over1:
invoke ShowWindow,[hWnd],[CmdShow]
invoke UpdateWindow,[hWnd]
StartLoop:
invoke GetMessage,addr msg,0,0,0
cmp eax,0
je > ExitLoop
invoke TranslateMessage,ADDR msg
invoke DispatchMessage,ADDR msg
jmp StartLoop
ExitLoop:
mov rax,[msg.wParam]
ret
endf
; --------------------------------------------------------
WndProc frame hWin, uMsg, wParam, lParam
USES rbp,rbx,rsi,rdi
LOCAL hDC:q
mov eax,[uMsg]
cmp eax,WM_DESTROY
je > msgDestroy
cmp eax,WM_CREATE
je > msgCreate
jmp > DefaultProc
msgDestroy:
invoke PostQuitMessage,0
xor rax,rax
ret
msgCreate:
xor eax,eax
ret
DefaultProc:
INVOKE DefWindowProc, [hWin], [uMsg], [wParam], [lParam]
ret
endf