Jump to content
  • Advertisement
Sign in to follow this  
VanillaSnake21

Calling WinMain from main() ?

This topic is 4252 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, I recetly saw a few of the games booting up from a command line prompt, and so I tried to implement it but I can't find a way of doing this without having to use WinMain() and main() in the same app, which the compiler flags as an error. Is there any way to go around this? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
If you were asking how to make your program launchable from the command line, it already is, regardless of which main function is used.

If you were asking how to make your program open a command window if not launched from one, yet need the parameters of WinMain, then you want the AllocConsole function (search Google, or better yet, The MSDN for it).

Share this post


Link to post
Share on other sites
There's nothing stopping a command line application (using main()) from opening a Win32 window and rendering in it using OpenGL/DirectX.

Share this post


Link to post
Share on other sites
As far as i know, if you making a console app, you must have a main() function in your code. And if you making a Win32 app, you must have a WinMain() function in your code. If you want to make a window for render but don't want to write silly WinMain prototype, just create a console app, with main() ofcourse, than create window using win32 functions just like normal.

PS. in theory it seems good. never tested by me.

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!