Thread: Silly WinMain question

  1. #1
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    Silly WinMain question

    What is the thing that stands right in front of WinMain? I've really never thought of it. It seems weird if it has two return values . Is it like unsigned that modifies a type, or something?
    I've also seen PASCAL used. What's the difference?
    Code:
    int WINAPI WinMain(...)
            ^
            |
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793

    Re: Silly WinMain question

    Originally posted by Magos
    What is the thing that stands right in front of WinMain? I've really never thought of it. It seems weird if it has two return values . Is it like unsigned that modifies a type, or something?
    I've also seen PASCAL used. What's the difference?
    Code:
    int WINAPI WinMain(...)
            ^
            |
    Its just a macro that defines a calling convention best suited to the situation....Its just a way of telling the compiler/linker how the function works

    It normally choses __stdcall....which basically means push the params of the function on the stack and the function will pop them off or restore the stack before return...Also it tells the compiler that the params will be passed to it right to left

    The PASCAL convention is like STDCALL, but passes left to right....PASCAL convention was used in 16bit windows....I think these days its just a define for STDCALL if you are using normal post 95 windows (so you still see it in code and it still works)........Best ignore it these days though and stick with WINAPI.

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Thanks for the info!
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. silly client server question
    By geek@02 in forum Windows Programming
    Replies: 10
    Last Post: 12-03-2007, 05:23 AM
  2. Design layer question
    By mdoland in forum C# Programming
    Replies: 0
    Last Post: 10-19-2007, 04:22 AM
  3. Silly question about sentence formatting
    By KerioStar in forum C++ Programming
    Replies: 4
    Last Post: 10-03-2006, 06:43 AM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM