Jump to content
  • Advertisement
Sign in to follow this  
_Phalanx_

I need to retrieve HWND and HINSTANCE for my window!

This topic is 4860 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

hey, i am using a backbuffering system called tiny PTC for my software rasterizer. The only problem is tiny ptc registers the window for my program within its init function. This means that I dont have access to the HWND and HINSTANCE for the window (i tried rewriting the tiny ptc but i dont understand it and it was a big disaster.) The reason i need to get the HWND and HINSTANCE for the window is that i need to use them for the initialization of DirectInput things. What i am wondering is if there is a windows API function that returns the HWND and HINSTANCE. Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Try GetActiveWindow() to get the HWND and you may be able to get the HINSTANCE by using GetModuleHandle() you program is wrapped up in a DLL, if not then I'm not sure about getting the HINSTANCE.

Share this post


Link to post
Share on other sites
If it's a console applicationm you can use:

HWND hwnd = GetForegroundWindow();

...and of couse for HINSTANCE (as described above) is:

HINSTANCE hInstance = GetModuleHandle(0);

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!