Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


win32 without WinMain


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 methinks   Members   -  Reputation: 217

Like
0Likes
Like

Posted 17 March 2005 - 09:43 AM

I have a program which, right now, runs as follows: 1. Starts at WinMain, which then create a Game object from my Game class, and passes it the hWnd. 2. The game object creates a graphics object, which is currently DirectX, and passes IT the hWnd. 3. Graphics object initializes, using the hWnd. It might seem a bit of a mess, my reason for doing this was to make it portable. To change renderers, all I would have to do would be to call a different graphics class. My question now is, is it possible to start the program by calling main instead of WinMain, and then create the windows class else where in the program? I imagine it should be possible, as OpenGL and SDL both work this way. The biggest challenge is to find a way to get the hInstance, which is usually passed into the program through WinMain. [Edited by - methinks on March 17, 2005 4:13:51 PM]

Sponsor:

#2 ryanzec01   Members   -  Reputation: 121

Like
0Likes
Like

Posted 17 March 2005 - 09:57 AM

you may want to create a title for the topic to get the interested of people who might be able to help you better.

#3 methinks   Members   -  Reputation: 217

Like
0Likes
Like

Posted 17 March 2005 - 10:16 AM

Oops, sorry about that!

#4 jollyjeffers   Crossbones+   -  Reputation: 1542

Like
0Likes
Like

Posted 17 March 2005 - 10:20 AM

I use GetModuleHandle( NULL ) to set the WNDCLASSEX::hInstance field when creating the window within the graphics engine.

For exactly the same reason, our application starts from a main and not a WinMain - to increase the ease of migrating to a different platform at some point in the future. Keep all platform specific code to the core engines, and everything else as standard C/C++ [smile].

hth
Jack
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

#5 methinks   Members   -  Reputation: 217

Like
0Likes
Like

Posted 17 March 2005 - 10:23 AM

Just what I was looking for, Thanks!

#6 b2b3   Members   -  Reputation: 602

Like
0Likes
Like

Posted 17 March 2005 - 10:54 AM

If you are not planning to realease under Win95/98/Me you can ignore value of hInstance (for example set to 0) when creating window - Windows NT/XP/2k do not use it (source).




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS