why is this failing?
.386
locals
jumps
.model flat,STDCALL
extrn ExitProcess : Proc
extrn CreateWindowExA : Proc
extrn GetModuleHandleA : Proc
extrn MessageBoxA : Proc
CW_USEDEFAULT EQU 8000h
WS_OVERLAPPEDWINDOW = WS_OVERLAPPED + WS_CAPTION + WS_SYSMENU + WS_THICKFRAME + WS_MINIMIZEBOX + WS_MAXIMIZEBOX
WS_OVERLAPPED = 00000h
WS_CAPTION = 000C0h
WS_SYSMENU = 00008h
WS_THICKFRAME = 00004h
WS_MINIMIZEBOX = 00002h
WS_MAXIMIZEBOX = 00001h
.data
ClassName db "SimpleWinClass",0
AppName db "Our First Window",0
hInstance dd ?
caption db "error!!!!!!!!!!!!!",0h
text db "SOMETHING FAILED!",0h
.code
Start:
push 0
call GetModuleHandleA
mov hInstance,eax
push 0
push hInstance
push 0
push 0
push CW_USEDEFAULT
push CW_USEDEFAULT
push CW_USEDEFAULT
push CW_USEDEFAULT
push WS_OVERLAPPEDWINDOW
push offset AppName
push offset ClassName
push 0
call CreateWindowExA
.if eax==0
push 00h
push offset caption
push offset text
push 0
call MessageBoxA
.else
push 0
call ExitProcess
.endif
End Start
CreateWindowEx creates a window based on a window class. But in your program, you only specified a name for a window class, but you haven't defined it. Standard window classes like BUTTON or EDIT, are defined by windows. But your own windows should be defined by yourself. Use RegisterClassEx to register your window classes (Iczelion has a tutorial on how to do it).
Thomas
This message was edited by Thomas, on 4/18/2001 3:09:51 PM
ok...
thanks...
i changed it to this
ClassName db "EDIT",0
thats an edit box that kinda looks like notepad right?
anyway, it compiles and when i run it; it just does nothing.
ie. the function doesnt fail and it reaches the end of the prog.
whats going on now???
Edit can not be main window. It must be child.
Edit is not like NotePad. NotPad is main window (dialog or some
own) and edit window on it.
The Svin.
Maybe next you will want to make a "message loop" ? :)
and to anticipate a alittle then you will need a windows "CallBack" procedure to deal with windows messages...and exit the message loop AFTER a WM_Quit message was received...and...
Now please ...have you read the Iczelions tutorials...because you will find the skeleton of a win32 program there...Also a little reading of Petzold's books ("Programming Windows") will help...
:)