there is a different structure to a windows program than there is to a normal console program. one of the main differences is the addition of the windows procedure.
the windows procedure is a function that handles the various messages sent to your program by windows. windows programming is all about getting messages and handling them. messages can be anything, ranging from window creation, to keyboard or mouse input, to drawing the window, and so on.
windows has a default message handler, but it really doesnt do much, so to get any real work out of your program you have to handle your own messages. to do this you write a window procedure. the prototype for it is as follows:
the first parameter is the handle to your window, the second is the ID of the message sent. the last two are extra information about the message ( for example, on a WM_LBUTTONDOWN message [left mouse click] the lParam holds the mouse coordinates ).
LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
one thing to keep in mind is that YOU never call the WndProc function in your program. instead, windows calls this function whenever a message is sent to your program, and it uses it to decide what to do with the message.
next, instead of main() you now have WinMain(). inside of WinMain, you create a WNDCLASS ( or WNDCLASSEX ) and set it up. this is the information about your program window. then you register the class and create the window. after doing that, you show the window and enter the message loop.
the message loop is another important part of a windows program. instead of putting a lot of code in WinMain, programmers normally keep their application specific code out of WinMain. normally i will write a class that handles the application, and just run something like app.AppMain() in my message loop. other than that, the message loop does nothing but get the messages and send them to the window procedure function. a message loop normally looks something like this:
the PeekMessage function looks at windows' message queue and puts the message into your MSG variable (here, msg). there is also GetMessage, but it doesnt return until a message appears, so it doesnt allow for idle time processing. in other words the program doesnt do anything while there are no messages being sent.
BOOL done = FALSE;
while ( !done )
if ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
if ( msg.message == WM_QUIT )
done == TRUE;
and that is a simple windows program. for setting up a WNDCLASS, registering it, and creating a window, you should just read up on some of those tutorials. they could probably explain it better than me.
i hope you have a better understanding of how it works now.