Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Can't get Window to display

shaolin007shaolin007 Member Posts: 1,018
I'm using FASM and I can't get the window to show up. Any help or ideas appreciated! :-)

[code]
format PE GUI 4.0
entry Main

include '%fasminc%win32a.inc'

section '.code' executable readable writeable

Main:
;WINDOW CLASS
push IDI_APPLICATION
push 0
call [LoadIcon]
mov [wndclass.hIconSm], eax
push [wndclass.hIconSm]

mov [wndclass.lpszClassName], _szClassName
push [wndclass.lpszClassName]

mov [wndclass.lpszMenuName], 0
push [wndclass.lpszMenuName]

push WHITE_BRUSH
call [GetStockObject]
mov [wndclass.hbrBackground], eax
push [wndclass.hbrBackground]

push IDC_ARROW
push 0
call [LoadCursor]
mov [wndclass.hCursor], eax
push [wndclass.hCursor]

push IDI_APPLICATION
push 0
call [LoadIcon]
mov [wndclass.hIcon], eax
push [wndclass.hIcon]

mov eax, [_hInstance]
mov [wndclass.hInstance], eax
push [wndclass.hInstance]

mov [wndclass.cbWndExtra], 0
push [wndclass.cbWndExtra]

mov [wndclass.cbClsExtra], 0
push [wndclass.cbClsExtra]

mov [wndclass.lpfnWndProc], WndProc
push [wndclass.lpfnWndProc]

mov eax, CS_HREDRAW
or eax, CS_VREDRAW
mov [wndclass.style], eax
push [wndclass.style]

mov eax, [wndclass]
mov [wndclass.cbSize], eax
push [wndclass.cbSize]
;END WINDOW CLASS

;REGISTER WINDOW CLASS
push wndclass
call [RegisterClass]

;CREATE WINDOW
mov [create.lpCreateParams], 0
push [create.lpCreateParams]

mov eax, [_hInstance]
mov [create.hInstance], eax
push [create.hInstance]

mov [create.hMenu], 0
push [create.hMenu]

mov [create.hwndParent], 0
push [create.hwndParent]

mov [create.cy], CW_USEDEFAULT
push [create.cy]

mov [create.cx], CW_USEDEFAULT
push [create.cy]

mov [create.y], CW_USEDEFAULT
push [create.y]

mov [create.x], CW_USEDEFAULT
push [create.x]

mov [create.style], WS_OVERLAPPEDWINDOW
push [create.style]

mov eax, _szWndCaption
mov [create.lpszName], eax
push [create.lpszName]

mov eax, _szClassName
mov [create.lpszClass], eax
push [create.lpszClass]

mov [create.dwExStyle], WS_EX_OVERLAPPEDWINDOW
push [create.dwExStyle]

call [CreateWindowEx]
mov [_hwnd], eax

;SHOW WINDOW
push [_iCmdShow]
push [_hwnd]
call [ShowWindow]

;UPDATE WINDOW
push [_hwnd]
call [UpdateWindow]

;MESSAGE LOOP
Msg_Loop:
push 0
push 0
push 0
push wmsg
call [GetMessage]
push wmsg
call [TranslateMessage]
cmp eax, WM_QUIT
je Exit_Msg_Loop
push wmsg
call [DispatchMessage]
jmp Msg_Loop

Exit_Msg_Loop:
push [wmsg.wParam]
call [ExitProcess]

WndProc:
mov eax, [wmsg.lParam]
mov [_lParam], eax
mov eax, [wmsg.wParam]
mov [_wParam], eax
mov eax, [wmsg.message]
mov [_iMsg], eax
mov eax, [wmsg.hwnd]
mov [_hwnd], eax

cmp [_iMsg], WM_PAINT
je Paint_Window
cmp [_iMsg], WM_DESTROY
je Destroy_Window
push [_lParam]
push [_wParam]
push [_iMsg]
push [_hwnd]
call [DefWindowProc]
jmp WndProc

Paint_Window:
push ps
push [_hwnd]
call [BeginPaint]
mov [_hdc], eax

push wrect
push [_hwnd]
call GetClientRect

mov eax, DT_VCENTER
or eax, DT_CENTER
or eax, DT_SINGLELINE
push eax
push wrect
push -1
push _szGreeting
push [_hdc]
call [DrawText]

push ps
push [_hwnd]
call [EndPaint]
mov eax, 0
ret

Destroy_Window:
push 0
call [PostQuitMessage]
mov eax, 0
ret

section '.data' data readable writeable

_hInstance dd ?
_hPrevInstance dd ?
_iCmdShow dd ?
_hwnd dd ?
_iMsg dd ?
_wParam dd ?
_lParam dd ?
_szClassName db "My Window",0
_szWndCaption db "My 1st Window",0
_hdc dd ?
_szGreeting db "Hello this is my 1st window!",0

;STRUCTS
wndclass WNDCLASSEX
wmsg MSG
create CREATESTRUCT
ps PAINTSTRUCT
wrect RECT

section '.idata' import data readable writeable

library kernel32,'KERNEL32.DLL',
user32,'USER32.DLL',
gdi32, 'GDI32.DLL'
include '%fasminc%apiakernel32.inc'
include '%fasminc%apiauser32.inc'
include '%fasminc%apiagdi32.inc'
[/code]

Comments

  • CroWCroW Member Posts: 348
    : I'm using FASM and I can't get the window to show up. Any help or ideas appreciated! :-)
    :
    : [code]
    : format PE GUI 4.0
    : entry Main
    :
    : include '%fasminc%win32a.inc'
    :
    : section '.code' executable readable writeable
    :
    : Main:
    : ;WINDOW CLASS
    : push IDI_APPLICATION
    : push 0
    : call [LoadIcon]
    : mov [wndclass.hIconSm], eax
    : push [wndclass.hIconSm]
    :
    : mov [wndclass.lpszClassName], _szClassName
    : push [wndclass.lpszClassName]
    :
    : mov [wndclass.lpszMenuName], 0
    : push [wndclass.lpszMenuName]
    :
    : push WHITE_BRUSH
    : call [GetStockObject]
    : mov [wndclass.hbrBackground], eax
    : push [wndclass.hbrBackground]
    :
    : push IDC_ARROW
    : push 0
    : call [LoadCursor]
    : mov [wndclass.hCursor], eax
    : push [wndclass.hCursor]
    :
    : push IDI_APPLICATION
    : push 0
    : call [LoadIcon]
    : mov [wndclass.hIcon], eax
    : push [wndclass.hIcon]
    :
    : mov eax, [_hInstance]
    : mov [wndclass.hInstance], eax
    : push [wndclass.hInstance]
    :
    : mov [wndclass.cbWndExtra], 0
    : push [wndclass.cbWndExtra]
    :
    : mov [wndclass.cbClsExtra], 0
    : push [wndclass.cbClsExtra]
    :
    : mov [wndclass.lpfnWndProc], WndProc
    : push [wndclass.lpfnWndProc]
    :
    : mov eax, CS_HREDRAW
    : or eax, CS_VREDRAW
    : mov [wndclass.style], eax
    : push [wndclass.style]
    :
    : mov eax, [wndclass]
    : mov [wndclass.cbSize], eax
    : push [wndclass.cbSize]
    : ;END WINDOW CLASS
    :
    : ;REGISTER WINDOW CLASS
    : push wndclass
    : call [RegisterClass]
    :
    : ;CREATE WINDOW
    : mov [create.lpCreateParams], 0
    : push [create.lpCreateParams]
    :
    : mov eax, [_hInstance]
    : mov [create.hInstance], eax
    : push [create.hInstance]
    :
    : mov [create.hMenu], 0
    : push [create.hMenu]
    :
    : mov [create.hwndParent], 0
    : push [create.hwndParent]
    :
    : mov [create.cy], CW_USEDEFAULT
    : push [create.cy]
    :
    : mov [create.cx], CW_USEDEFAULT
    : push [create.cy]
    :
    : mov [create.y], CW_USEDEFAULT
    : push [create.y]
    :
    : mov [create.x], CW_USEDEFAULT
    : push [create.x]
    :
    : mov [create.style], WS_OVERLAPPEDWINDOW
    : push [create.style]
    :
    : mov eax, _szWndCaption
    : mov [create.lpszName], eax
    : push [create.lpszName]
    :
    : mov eax, _szClassName
    : mov [create.lpszClass], eax
    : push [create.lpszClass]
    :
    : mov [create.dwExStyle], WS_EX_OVERLAPPEDWINDOW
    : push [create.dwExStyle]
    :
    : call [CreateWindowEx]
    : mov [_hwnd], eax
    :
    : ;SHOW WINDOW
    : push [_iCmdShow]
    : push [_hwnd]
    : call [ShowWindow]
    :
    : ;UPDATE WINDOW
    : push [_hwnd]
    : call [UpdateWindow]
    :
    : ;MESSAGE LOOP
    : Msg_Loop:
    : push 0
    : push 0
    : push 0
    : push wmsg
    : call [GetMessage]
    : push wmsg
    : call [TranslateMessage]
    : cmp eax, WM_QUIT
    : je Exit_Msg_Loop
    : push wmsg
    : call [DispatchMessage]
    : jmp Msg_Loop
    :
    : Exit_Msg_Loop:
    : push [wmsg.wParam]
    : call [ExitProcess]
    :
    : WndProc:
    : mov eax, [wmsg.lParam]
    : mov [_lParam], eax
    : mov eax, [wmsg.wParam]
    : mov [_wParam], eax
    : mov eax, [wmsg.message]
    : mov [_iMsg], eax
    : mov eax, [wmsg.hwnd]
    : mov [_hwnd], eax
    :
    : cmp [_iMsg], WM_PAINT
    : je Paint_Window
    : cmp [_iMsg], WM_DESTROY
    : je Destroy_Window
    : push [_lParam]
    : push [_wParam]
    : push [_iMsg]
    : push [_hwnd]
    : call [DefWindowProc]
    : jmp WndProc
    :
    : Paint_Window:
    : push ps
    : push [_hwnd]
    : call [BeginPaint]
    : mov [_hdc], eax
    :
    : push wrect
    : push [_hwnd]
    : call GetClientRect
    :
    : mov eax, DT_VCENTER
    : or eax, DT_CENTER
    : or eax, DT_SINGLELINE
    : push eax
    : push wrect
    : push -1
    : push _szGreeting
    : push [_hdc]
    : call [DrawText]
    :
    : push ps
    : push [_hwnd]
    : call [EndPaint]
    : mov eax, 0
    : ret
    :
    : Destroy_Window:
    : push 0
    : call [PostQuitMessage]
    : mov eax, 0
    : ret
    :
    : section '.data' data readable writeable
    :
    : _hInstance dd ?
    : _hPrevInstance dd ?
    : _iCmdShow dd ?
    : _hwnd dd ?
    : _iMsg dd ?
    : _wParam dd ?
    : _lParam dd ?
    : _szClassName db "My Window",0
    : _szWndCaption db "My 1st Window",0
    : _hdc dd ?
    : _szGreeting db "Hello this is my 1st window!",0
    :
    : ;STRUCTS
    : wndclass WNDCLASSEX
    : wmsg MSG
    : create CREATESTRUCT
    : ps PAINTSTRUCT
    : wrect RECT
    :
    : section '.idata' import data readable writeable
    :
    : library kernel32,'KERNEL32.DLL',
    : user32,'USER32.DLL',
    : gdi32, 'GDI32.DLL'
    : include '%fasminc%apiakernel32.inc'
    : include '%fasminc%apiauser32.inc'
    : include '%fasminc%apiagdi32.inc'
    : [/code]
    :
    :

    oha,way to much code to read this evening.i prefer to use a resource-editor to create a dialog and use the CreateDialog-call.just take care to pass the right modulehandle.the hInst-value passed to main will fail on some machines,it took me hours to solve that ;)

    GetModuleHandle() works on all tested machines.the produced exe is in most cases the same size like pure assembler-code.however,when designing windows with a lot controls the resource is design faster and produces smaller code.
  • AsmGuru62AsmGuru62 Member Posts: 6,519
    [blue]See my comments in RED...

    Also:

    1. Why not use the TEMPLATE.ASM which comes with FASM? Because you have way too much wrong code in here...

    2. Why not using [b]invoke[/b] macro to call Win32 API? All these PUSH-es are just too confusing.
    [/blue]

    : I'm using FASM and I can't get the window to show up. Any help or ideas appreciated! :-)
    :
    : [code]
    : format PE GUI 4.0
    : entry Main
    :
    : include '%fasminc%win32a.inc'
    :
    : section '.code' executable readable writeable
    :
    : Main:
    : ;WINDOW CLASS
    : push IDI_APPLICATION
    : push 0
    : call [LoadIcon]
    : mov [wndclass.hIconSm], eax
    : push [wndclass.hIconSm] [b][red];Why all these pushes?[/red][/b]
    :
    : mov [wndclass.lpszClassName], _szClassName
    : push [wndclass.lpszClassName] [b][red];Why all these pushes?[/red][/b]
    :
    : mov [wndclass.lpszMenuName], 0
    : push [wndclass.lpszMenuName] [b][red];Why all these
    pushes? ... and so on - you just destroying stack with these pushes.
    They are not needed. Just fill the structure and call RegisterClass()[/red][/b]
    :
    : push WHITE_BRUSH
    : call [GetStockObject]
    : mov [wndclass.hbrBackground], eax
    : push [wndclass.hbrBackground]
    :
    : push IDC_ARROW
    : push 0
    : call [LoadCursor]
    : mov [wndclass.hCursor], eax
    : push [wndclass.hCursor]
    :
    : push IDI_APPLICATION
    : push 0
    : call [LoadIcon]
    : mov [wndclass.hIcon], eax
    : push [wndclass.hIcon]
    :
    : mov eax, [_hInstance]
    : mov [wndclass.hInstance], eax
    : push [wndclass.hInstance]
    :
    : mov [wndclass.cbWndExtra], 0
    : push [wndclass.cbWndExtra]
    :
    : mov [wndclass.cbClsExtra], 0
    : push [wndclass.cbClsExtra]
    :
    : mov [wndclass.lpfnWndProc], WndProc
    : push [wndclass.lpfnWndProc]
    :
    : mov eax, CS_HREDRAW
    : or eax, CS_VREDRAW
    : mov [wndclass.style], eax
    : push [wndclass.style]
    :
    : mov eax, [wndclass]
    : mov [wndclass.cbSize], eax
    : push [wndclass.cbSize]
    : ;END WINDOW CLASS
    :
    : ;REGISTER WINDOW CLASS
    : push wndclass
    : call [RegisterClass]
    :
    : ;CREATE WINDOW
    : mov [create.lpCreateParams], 0
    : push [create.lpCreateParams]
    :
    : mov eax, [_hInstance]
    : mov [create.hInstance], eax
    : push [create.hInstance]
    :
    : mov [create.hMenu], 0
    : push [create.hMenu]
    :
    : mov [create.hwndParent], 0
    : push [create.hwndParent]
    :
    : mov [create.cy], CW_USEDEFAULT
    : push [create.cy]
    :
    : mov [create.cx], CW_USEDEFAULT
    : push [create.cy]
    :
    : mov [create.y], CW_USEDEFAULT
    : push [create.y]
    :
    : mov [create.x], CW_USEDEFAULT
    : push [create.x]
    :
    : mov [create.style], WS_OVERLAPPEDWINDOW
    : push [create.style]
    :
    : mov eax, _szWndCaption
    : mov [create.lpszName], eax
    : push [create.lpszName]
    :
    : mov eax, _szClassName
    : mov [create.lpszClass], eax
    : push [create.lpszClass]
    :
    : mov [create.dwExStyle], WS_EX_OVERLAPPEDWINDOW
    : push [create.dwExStyle]
    :
    : call [CreateWindowEx]
    : mov [_hwnd], eax
    :
    : ;SHOW WINDOW
    : push [_iCmdShow]
    : push [_hwnd]
    : call [ShowWindow]
    :
    : ;UPDATE WINDOW
    : push [_hwnd]
    : call [UpdateWindow]
    :
    : ;MESSAGE LOOP
    : Msg_Loop:
    : push 0
    : push 0
    : push 0
    : push wmsg
    : call [GetMessage]
    : push wmsg
    : call [TranslateMessage]
    : cmp eax, WM_QUIT
    : je Exit_Msg_Loop
    : push wmsg
    : call [DispatchMessage]
    : jmp Msg_Loop
    :
    : Exit_Msg_Loop:
    : push [wmsg.wParam]
    : call [ExitProcess]
    :
    [b][red];The window procedure should be of __stdcall convention, that
    means the parameters are coming from stack and not from that
    structure you are using.

    Also, this function supposed to return with RET 10H instruction,
    and not with a simple RET, because __stdcall dictates that behaviour.[/red][/b]
    : WndProc:
    : mov eax, [wmsg.lParam]
    : mov [_lParam], eax
    : mov eax, [wmsg.wParam]
    : mov [_wParam], eax
    : mov eax, [wmsg.message]
    : mov [_iMsg], eax
    : mov eax, [wmsg.hwnd]
    : mov [_hwnd], eax
    :
    : cmp [_iMsg], WM_PAINT
    : je Paint_Window
    : cmp [_iMsg], WM_DESTROY
    : je Destroy_Window
    : push [_lParam]
    : push [_wParam]
    : push [_iMsg]
    : push [_hwnd]
    : call [DefWindowProc]
    : jmp WndProc ;[b][red]That's endless loop - you jumping
    back where it came from![/red][/b]
    :
    : Paint_Window:
    : push ps
    : push [_hwnd]
    : call [BeginPaint]
    : mov [_hdc], eax
    :
    : push wrect
    : push [_hwnd]
    : call GetClientRect
    :
    : mov eax, DT_VCENTER
    : or eax, DT_CENTER
    : or eax, DT_SINGLELINE
    : push eax
    : push wrect
    : push -1
    : push _szGreeting
    : push [_hdc]
    : call [DrawText]
    :
    : push ps
    : push [_hwnd]
    : call [EndPaint]
    : mov eax, 0
    : ret
    :
    : Destroy_Window:
    : push 0
    : call [PostQuitMessage]
    : mov eax, 0
    : ret
    :
    : section '.data' data readable writeable
    :
    : _hInstance dd ?
    : _hPrevInstance dd ?
    : _iCmdShow dd ?
    : _hwnd dd ?
    : _iMsg dd ?
    : _wParam dd ?
    : _lParam dd ?
    : _szClassName db "My Window",0
    : _szWndCaption db "My 1st Window",0
    : _hdc dd ?
    : _szGreeting db "Hello this is my 1st window!",0
    :
    : ;STRUCTS
    : wndclass WNDCLASSEX
    : wmsg MSG
    : create CREATESTRUCT
    : ps PAINTSTRUCT
    : wrect RECT
    :
    : section '.idata' import data readable writeable
    :
    : library kernel32,'KERNEL32.DLL',
    : user32,'USER32.DLL',
    : gdi32, 'GDI32.DLL'
    : include '%fasminc%apiakernel32.inc'
    : include '%fasminc%apiauser32.inc'
    : include '%fasminc%apiagdi32.inc'
    : [/code]
    :
    :

  • shaolin007shaolin007 Member Posts: 1,018
    : [blue]See my comments in RED...
    :
    : Also:
    :
    : 1. Why not use the TEMPLATE.ASM which comes with FASM? Because you have way too much wrong code in here...
    [green]
    I just want to do the hardway first so I can fully understand what is happening with the window.
    [/green]

    : 2. Why not using [b]invoke[/b] macro to call Win32 API? All these PUSH-es are just too confusing.
    : [/blue]
    [green]
    Yea it does look confusing and I will in the future shorten my code with macros but 1st I want to do it this way.
    [/green]


    [green]
    Doh! Those were some stupid errors! :-) Thanks for taking the time and pointing them out. I'll have to revamp my code to what you said, thanks again!
    [/green]


  • Johnny13Johnny13 Member Posts: 128
    : [blue]See my comments in RED...
    :
    : Also:
    :
    : 1. Why not use the TEMPLATE.ASM which comes with FASM? Because you have way too much wrong code in here...
    :
    : 2. Why not using [b]invoke[/b] macro to call Win32 API? All these PUSH-es are just too confusing.
    : [/blue]
    :
    [purple]Who on earth would push every members of wndclass in order to register it??
    [green]"shaolin007"[/green] - who hasn't done a simple window in C first, but managed to "do the hardway", and don't RTFM but cross-posting bloated code and want us explain win32 to him, on a wrong board..[/purple] :-)
    http://www.pheaven.com/c/MsgBoard/read.asp?Board=10&MsgID=231240
  • shaolin007shaolin007 Member Posts: 1,018
    [b][red]This message was edited by shaolin007 at 2005-6-7 8:55:24[/red][/b][hr]
    [red]" want us explain win32 to him, on a wrong board"[/red]
    [green]
    Well if it's assembly then shouldn't it be posted on the assembly board? I mean I could import c functions into my assembler but would that mean I should post on the c board then?
    [/green]

    [red]
    Who on earth would push every members of wndclass in order to register it??
    [/red]

    [green]
    Yea your right who would? :-D
    [/green]

    [red]
    who hasn't done a simple window in C first, but managed to "do the hardway
    [/red]

    [green]
    Wonderfull isn't it? :-)
    [/green]


    [red]
    http://www.pheaven.com/c/MsgBoard/read.asp?Board=10&MsgID=231240
    [/red]

    [green]
    Man thats an old post and the code is nearly unreadable. Who taught you how to format your code? :-)
    [/green]

    [code]
    format PE GUI 4.0
    entry Main

    include 'C:fasmincludewin32a.inc'

    section '.code' executable readable writeable

    Main:
    ;WINDOW CLASS
    push IDI_APPLICATION
    push 0
    call [LoadIcon]
    mov [wndclass.hIcon], eax

    mov [wndclass.lpszClassName], _szClassName

    mov [wndclass.lpszMenuName], 0

    push WHITE_BRUSH
    call [GetStockObject]
    mov [wndclass.hbrBackground], eax

    push IDC_ARROW
    push 0
    call [LoadCursor]
    mov [wndclass.hCursor], eax

    push IDI_APPLICATION
    push 0
    call [LoadIcon]
    mov [wndclass.hIcon], eax

    push 0
    call [GetModuleHandle]
    mov [_hInstance], eax
    mov [wndclass.hInstance], eax

    mov [wndclass.cbWndExtra], 0

    mov [wndclass.cbClsExtra], 0

    mov [wndclass.lpfnWndProc], WndProc

    mov eax, CS_HREDRAW
    or eax, CS_VREDRAW
    mov [wndclass.style], eax

    ;REGISTER WINDOW CLASS
    push wndclass
    call [RegisterClass]

    ;CREATE WINDOW
    push 0
    push [_hInstance]
    push 0
    push 0
    push CW_USEDEFAULT
    push CW_USEDEFAULT
    push CW_USEDEFAULT
    push CW_USEDEFAULT
    push WS_OVERLAPPEDWINDOW
    push _szWndCaption
    push _szClassName
    push WS_EX_OVERLAPPEDWINDOW
    call [CreateWindowEx]
    mov [hwnd], eax

    ;SHOW WINDOW
    push SW_SHOW
    push [hwnd]
    call [ShowWindow]

    ;UPDATE WINDOW
    push [hwnd]
    call [UpdateWindow]

    ;MESSAGE LOOP
    Msg_Loop:
    push 0
    push 0
    push 0
    push wmsg
    call [GetMessage]
    or eax,eax
    jz Exit_Msg_Loop
    push wmsg
    call [TranslateMessage]
    push wmsg
    call [DispatchMessage]
    jmp Msg_Loop

    Exit_Msg_Loop:
    push [wmsg.wParam]
    call [ExitProcess]

    _hwnd equ ebp+8
    _iMsg equ ebp+0Ch
    _wParam equ ebp+10h
    _lParam equ ebp+14h
    WndProc:
    push ebp
    mov ebp, esp
    push ebx esi edi
    cmp dword [_iMsg], WM_PAINT
    je Paint_Window
    cmp dword [_iMsg], WM_DESTROY
    je Destroy_Window
    Def_Win_Proc:
    push dword [_lParam]
    push dword [_wParam]
    push dword [_iMsg]
    push dword [_hwnd]
    call [DefWindowProc]
    jmp Exit

    Paint_Window:
    push ps
    push dword [_hwnd]
    call [BeginPaint]
    mov [_hdc], eax

    push wrect
    push dword [_hwnd]
    call [GetClientRect]

    mov eax, DT_VCENTER
    or eax, DT_CENTER
    or eax, DT_SINGLELINE
    push eax
    push wrect
    push -1
    push _szGreeting
    push [_hdc]
    call [DrawText]

    push ps
    push dword [_hwnd]
    call [EndPaint]
    jmp Exit

    Destroy_Window:
    push 0
    call [PostQuitMessage]
    Exit:
    pop edi esi ebx
    pop ebp
    ret 10h

    section '.data' data readable writeable
    hwnd dd ?
    _hInstance dd ?
    _szClassName db "My Window",0
    _szWndCaption db "My 1st Window",0
    _hdc dd ?
    _szGreeting db "Hello this is my 1st window!",0

    ;STRUCTS
    wndclass WNDCLASS
    wmsg MSG
    ps PAINTSTRUCT
    wrect RECT

    section '.idata' import data readable writeable

    library kernel32,'KERNEL32.DLL',
    user32,'USER32.DLL',
    gdi32, 'GDI32.DLL'
    include 'C:fasmincludeapiakernel32.inc'
    include 'C:fasmincludeapiauser32.inc'
    include 'C:fasmincludeapiagdi32.inc'
    [/code]

    [green]
    Proud of me now? By the way, is english you second language? No sarcasm intended.
    [/green]

    [red]
    don't RTFM = Do not RTFM
    [/red]

    [green]
    By the way, it should be does not RTFM. Maybe you should read it also?
    [/green]


Sign In or Register to comment.