Sign in to follow this  
c0uchm0nster

Dereferencing handles (managed c++)

Recommended Posts

So, first off: How in the world do I create a project in VC++ 2005 Express that does NOT use managed code and will still let me create forms? And is it advisable to do this, or should I always use managed code when I'm working with forms (I don't see why I should, but there's a lot I don't know). Secondly, and to the point of the problem I'm struggling with right now, I can't find much on dereferencing handles to objects. More specifically, I have figured out how to dereference a single handle to object so I can use it as a pointer, but I can't figure out how to dereference a handle that's a member of a handle. For example:
public ref class myForm : public System::Windows::Forms::Form {
	public:
		myForm(void){}
		System::Windows::Forms::Panel^ myPanel;
};

ref class Engine
{
	public:
		Engine();
	private:
		myForm^ m_MyForm;
		void* m_ptr;
};

Engine::Engine()
{
	m_MyForm = gcnew myForm();
	m_ptr = m_MyForm->myPanel;
};

I'm trying to create a d3d device in a panel... which is close-to-brainless in c#, so i'm guessing it has to be similarly simple in managed c++ - but i just can't figure out how to give the device method an IntPtr to the panel... Any help would be greatly appreciated. Thank you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this