Jump to content
  • Advertisement


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


*newb* Managed C++ problem

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

First time I''ve used Managed C++ so its probably something easy that I''m missing. This is the error I am getting, I''m pretty much using the same code as is in the DirectX Managed SDK...
cannot convert parameter 5 from Microsoft::DirectX::Direct3D:resentParameters __gc * to System::IntPtr 
PresentParameters *presParam = new PresentParameters();

presParam->Windowed = true;
/* ... etc */

// pWindow is a pointer to a System::Windows::Forms::Control

m_pD3dDevice = new Direct3D::Device(0, DeviceType::Hardware, pWindow, CreateFlags::SoftwareVertexProcessing, presParam);
Now am I doing something really stupid? bangz.

Share this post

Link to post
Share on other sites
Hmmmm its been a while since ive used MC++ but I might be able to help.

You might have to __pin the pointer so it doesnt move around in memory and then just cast to IntPtr. Look up pinning on MSDN.

Alternatively, you can try creating presParam on the stack and just send &presParam to the Device constructor.

Share this post

Link to post
Share on other sites
The last argument to the Device constructor is a params array, a mechanism used in C#(and VB.NET?) for variable numbers of arguments. MC++ doesn''t seem to support this, so you need to pass in an array explicitly.

This compiles for me:

PresentParameters* parray[] = new PresentParameters*[1];
parray[0] = new PresentParameters();

Device* d = new Device(0, DeviceType::Hardware, new Control(),
parray );

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!