Jump to content
  • Advertisement
Sign in to follow this  
Azrael

DirectInput DLL

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

Im trying to create a Direct X Wrapper based on dll , however Ive ran in a problem Whn I try to set the cooperative level I need to get a HWND pointer, which I dont have because Im using a dll. Right now Im using the FindWindow command But If I change the name of my test to anything other than DLL demo it wont work.
  if( FAILED( hr = g_pJoystick->SetCooperativeLevel( FindWindow(NULL, "Dll Demo"), DISCL_EXCLUSIVE | 
                                                             DISCL_FOREGROUND ) ) )
        return hr;
How can I get the HWND of the window that is calling my DLL ?

Share this post


Link to post
Share on other sites
Advertisement
The most obvious, direct, and recommended approach is to make the caller pass it to the DLL. Additionally, this gives more control to the caller, because he can have many windows, and select one of them and pass it to you.

On a sidenote, if you're writing a wrapper and you're not aiming for cross-platform development (you're using a DLL already...) make it as thin as possible, or re-evaluate your need for a wrapper and drop it altogether if you don't need it. Focus on what you want to get the game done, the input system itself, not wrappers.

Share this post


Link to post
Share on other sites
Hmm.. good answer thanks, but lets suppose I need to get the Parent HWND is there anyway to do that?

Share this post


Link to post
Share on other sites
Quote:
Original post by Azrael
Hmm.. good answer thanks, but lets suppose I need to get the Parent HWND is there anyway to do that?

I don't know for sure, but I don't think so. You can't even guarantee there's a HWND; the DLL could be loaded by an application that created no windows.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!