Jump to content
  • Advertisement
Sign in to follow this  

How to render DirectX9 on my CLR customed control?

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

My CLR project have many Split Containers, one Container has a customed user control. I want to Render a cylinder with DirectX9 on the user control. Could somebody tell how to get windows handle of user control or render with DirectX?

Share this post

Link to post
Share on other sites
Thank you, I can create device successfully.
But another problem appear when I create device using the variable d3ddev.
It appears error message as below:

Error 1 error C2664: 'IDirect3D9::CreateDevice' : cannot convert parameter 6 from 'cli::interior_ptr<Type>' to 'IDirect3DDevice9 **' d:\svn\.....\PreviewView.h 121

So I use another local variable(d3ddevTmp) to create device and then set the d3ddevTmp to d3ddev member variable.

That is my partial source code:

public ref class PreviewView : public System::Windows::Forms::UserControl


private: void initD3D(HWND hHandle)
d3d = Direct3DCreate9(D3D_SDK_VERSION); // create the Direct3D interface

ZeroMemory(pd3dpp, sizeof(*pd3dpp)); // clear out the struct for use
pd3dpp->Windowed = true; // program windowed, not fullscreen
pd3dpp->SwapEffect = D3DSWAPEFFECT_DISCARD; // discard old frames
pd3dpp->hDeviceWindow = hHandle; // set the window to be used by Direct3D


// create a device class using this information and information from the d3dpp stuct


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!