News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

question winmain proto

Started by anuradha, March 13, 2007, 09:26:12 PM

Previous topic - Next topic

anuradha

hi people

WinMain proto :DWORD,:DWORD,:DWORD,:DWORD
cna anyone tell me what this means
thanks

MaynardG_Krebs

WinMain proto :DWORD,:DWORD,:DWORD,:DWORD

This is the prototype declaration for the WinMain procedure, which is the startup procedure for a windows program. Kind of like the main procedure in a DOS program.

PBrennick

It also means you have to include 4 parameters when you invoke it.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

Tedd

The actual purpose is to tell the assembler that there exists a function named "WinMain" somewhere in the code (and that it takes 4 dwords as parameters - so that "invoke" can check you called it correctly.)
It's only necessary if the function is invoked in code that appears before the function definition (the code that makes up the function) itself.

Example:

WinMain proto .....
    :
invoke WinMain, .....
    :

WinMain proc ........
    :
WinMain endp


..whereas, it wouldn't be necessary the other way around, because the function has already been seen.

WinMain proc ........
    :
WinMain endp

    :
invoke WinMain, .....
    :



The short answer: it's a 'heads up' for the assembler (try removing it and see the error message.)
No snowflake in an avalanche feels responsible.

hutch--

anuradha,

Something to keep in mind, in assembler you can construct a programs entry to call a WinMain but you must provide the command line address and instance yourself which are normally done with API calls. A WinMain was originally a C code entry point for a Windows app where the compiler supplied the instance handle and command line but you do not have to write it that way in assembler.

All you need in assembler is an entry point, commonly a label "start:" which is terminated at the other end of the program with "end start". The rest you write yourself which is how most assembler apps are written.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php