Jump to content
  • Advertisement

Archived

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

bangz

SWIG, C++ DLL -> C#, with DirectX

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

Hello, I am using SWIG to generate some C# wrappers for my classes stored within a DLL. I''m trying to send a handle of a picture box to my Gfx Dll, but its giving me problems. Here''s how I''m doing it...
private void Form1_Load(object sender, System.EventArgs e)
{
   CGfxManager GfxEngine = new CGfxManager();
   SWIGTYPE_p_HWND hWnd = new SWIGTYPE_p_HWND(this.Handle, true);
   if(!GfxEngine.Initialise(hWnd))
      MessageBox.Show(this, "Failed to Initialise");
}
 
Now it seems to be coming thru to my Initialise function ok (within my DLL, hWnd = 0x00020000), but m_pD3dObject->CreateDevice(...) is failing. Is there something I''m missing? Prehaps C# handles are different from the ones used in the C++ project? Regards, Bangz.

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by bangz
Prehaps C# handles are different from the ones used in the C++ project?


No, the whole point of the .Handle property is that you can use it to pass into unmanaged APIs that require a HWND.

It does seem as if you are sending the handle of the form, though, not that of the picture box. However, it should work either way.

Cannot help any more without seeing more code.




--
AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.
[Project site] [Blog] [RSS] [Browse the source] [IRC channel]

Share this post


Link to post
Share on other sites

  • 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!