Hello, I am fairly new to ASM. I've started off with the tutorials on win32asm.cjb.net. They were alright until it go to the 'simple window #3' part.
What I don't get is, where does all this code come from?

invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT        ; call the main function
invoke ExitProcess, eax                          ; quit our program. The exit code is returned in eax from WinMain.

WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
    LOCAL wc:WNDCLASSEX                                            ; create local variables on stack
    LOCAL msg:MSG
    LOCAL hwnd:HWND

    mov  wc.cbSize,SIZEOF WNDCLASSEX                  ; fill values in members of wc
    mov  wc.style, CS_HREDRAW or CS_VREDRAW
    mov  wc.lpfnWndProc, OFFSET WndProc
    mov  wc.cbClsExtra,NULL
    mov  wc.cbWndExtra,NULL
    push  hInstance
    pop  wc.hInstance
    mov  wc.hbrBackground,COLOR_WINDOW+1
    mov  wc.lpszMenuName,NULL
    mov  wc.lpszClassName,OFFSET ClassName
    invoke LoadIcon,NULL,IDI_APPLICATION
    mov  wc.hIcon,eax
    mov  wc.hIconSm,eax
    invoke LoadCursor,NULL,IDC_ARROW
    mov  wc.hCursor,eax
    invoke RegisterClassEx, addr wc                      ; register our window class
    invoke CreateWindowEx,NULL,\
                ADDR ClassName,\
                ADDR AppName,\
                WS_OVERLAPPEDWINDOW,\
                CW_USEDEFAULT,\
                CW_USEDEFAULT,\
                CW_USEDEFAULT,\
                CW_USEDEFAULT,\
                NULL,\
                NULL,\
                hInst,\
                NULL
    mov  hwnd,eax
    invoke ShowWindow, hwnd,CmdShow              ; display our window on desktop
    invoke UpdateWindow, hwnd 


Any help would be greatly appreciated. Thank you
Posted on 2006-03-09 19:28:56 by bionet
bionet,
That code is how you create a window using the Windows API. This has to be done in C/C++ or whatever language you are using, as well as assembly. WinMain is a procedure which he calls that fills in the data of the WNDCLASSEX structure, registers the window class to the operating system, then creates the window. The two last lines show and update the newly created window before it drops into the message loop. On return it goes back to the line after the invoke WinMain.. statement and executes the ExitProcess command to close the application. I'm pretty sure the tutorial goes over this, maybe you should cross-reference MSDN for more information about how Windows programming actually works while you are reading Iczelion's tutorials.

Regards,
Bryant Keller
Posted on 2006-03-09 20:40:57 by Synfire