Jump to content
  • Advertisement
Sign in to follow this  
Raxvan

problem understanding wondows and directx programing

This topic is 4837 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi ma name is Razvan and i am from romania. I started learning programing in Borland pascal a long time ago.then i was learning from a teacher.After that i started learning from books and magazines . Now i know c++ and DJGPP. these are so well implemented in my head that i find impossible to understand windows programing whatever what i read about it. Someone please help me understand the most simple program.

Share this post


Link to post
Share on other sites
Advertisement

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
return 0;
}

This is the most simple Windows program. You'll notice that the only difference from a console program is the number of arguments to main (and the name, which is changed to WinMain). Because Windows is multitasking, it provides INSTANCEs to let you know if there is more than one copy of your program running -- so hInstance is the copy that was just opened, and hPrevInstance is the one before it (if there is one). lpCmdLine is the command line to your program. Nowadays, this is mostly a remnant from good old DOS, but beginners and simple programs can use it to detect if a file was dragged'n'dropped on the exe (or you can run your program from the command prompt, if you like). It's not separated into the various arguments like the classic main, so you have to parse it yourself. Finally, nShowCmd is a way of telling you that, if you create a window, it needs to be shown a certain way.

Creating windows, and managing them, is rather more complex. First, you must fill in and register a window class. Then you call CreateWindow or CreateWindowEx to create the window, then ShowWindow to show it (in most cases). Finally, you go into a loop to start pumping messages: as a part of creating the window class, you define a message processing function that will be called whenever the user does something to your window -- for example, when they click it, the message function will get a WM_CLICK message.

To see all of this put together in a fairly simple windowed application, view A Generic Sample Application from the MSDN Library.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!