• Advertisement

Archived

This topic is now archived and is closed to further replies.

Passing HWND's

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

I''ve been digging deeper into engine structure with DLL''s and found a (to me) nasty problem. As we all know, DirectX and OpenGL needs access to an HWND. If you conbine two of these parts (e.g. DirectInput and OpenGL) they need to have access to the SAME HWND and there''s my problem. At my current state, I''ve got 2 DLL''s (Audio and Video) and 1 executable (Main.exe) I know need a way for all these 3 parts to use the SAME hwnd. Is there someone out there that can throw me a candle over this problem?

Share this post


Link to post
Share on other sites
Advertisement
Well, I guess that the Audio dosen''t need it''s own unique HWND. Only the video does (for the window to draw to)
My idea:
Create a window in main.exe
Pass that HWND to some init function that is in each DLL

Example:

//A line in the .H file for Audio
bool InitAudio(HWND AppHwnd);

//A line in the .H file for Video
bool InitVideo(HWND AppHwnd);

//Include both of these in the main.exe and in the WinMain()
//...Create Window
if(!InitAudio(CreatedHwnd))
//Error
if(!InitVideo(CreatedHwnd))
//Error

//In each DLL create a global variable that holds the HWND passed to it.

Share this post


Link to post
Share on other sites

  • Advertisement