Jump to content
  • Advertisement
Sign in to follow this  
Paul C Skertich

Trouble when attaching Handle to Managed DLL HWND.

This topic is 2344 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 took Kunos advice and started to create a Managed DLL file to put in C#. This is just a level editor, so seemed a better ideal. I did some research and a IntPtr is Handle for a windows form control. So, I'm trying to put the DirectX inside a Panel control. I tested out a test out DLL of just returning a string in the Managed DLL and it worked well in C#.

On additional notes, I tried to have it the OutputWindow as a IntPtr in C++ but insisted it has to be a HWND.

It may just be simple and I've over looked something.

Here's the Managed DLL compiled as Old Syntax CLI.

_h = h;
// create a struct to hold information about the swap chain
// clear out the struct for use
ZeroMemory(&scd, sizeof(DXGI_SWAP_CHAIN_DESC));
// fill the swap chain description struct
scd.BufferCount = 1; // one back buffer
scd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; // use 32-bit color
scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; // how swap chain is to be used
scd.OutputWindow = _h; // the window to be used
scd.SampleDesc.Count = 1; // how many multisamples
scd.SampleDesc.Quality = 0; // multisample quality level
scd.Windowed = TRUE; // windowed/full-screen mode

inside the private function I have the HWND _h;

I was thinking, well okay maybe it needs to return the handle. So perhaps, it needs to set it which I thought it was doing it.

Inside the C# Form1_Load I have this snipplet.

SICGames.Engine SE = new SICGames.Engine();
IntPtr _DXView = panel1.Handle;

I know that the Overloaded Method Match is because the arguments don't match. If there is a work around or possible a small tiny mistake I'm doign that can pointed out that would be awesome. A IntPtr should be fine with HWND, right? Thanks everyone!

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!