Jump to content
  • Advertisement
Sign in to follow this  
pasman

Getting the instance handler from a console app

This topic is 4700 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, this might be a silly question, but I have a console C++ application with lots of console I/O, but I also need to create windows but I have to "fill in" the instance handler of the application. Is there a way to retrieve this other than using WinMain as an entry point to the application? Thank you.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by pasman
Hi, this might be a silly question, but I have a console C++ application with lots of console I/O, but I also need to create windows but I have to "fill in" the instance handler of the application.

Is there a way to retrieve this other than using WinMain as an entry point to the application? Thank you.


I think you can do:
HINSTANCE hinstance = GetModuleHandle(0);

Share this post


Link to post
Share on other sites
Thanks, but reading through msdn I understand that GetModuleHandle works for dll and if I pass 0 as parameter...

"If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process (.exe file)."

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!