How to get HWND from System::Windows::Forms::Panel^ panel [modified]
-
Hi VC++ 2005 EE I'm writing an app which is going to display some 3D figures on System::Windows::Forms::Panel^ panel The problem: I've written my own class which handles all OpenGL stuff. So all I have to do is: Create new 3D figure object, and draw it with panel's Paint method. Constructor needs panel's HWND, so i did something like this:
TFigure *Figure; //pointer to my base class objects Figure = new TCuboid( (HWND)panel->Handle.ToPointer() , panel->Width, panel->Height, 3, 3, 7 );
But this solution doesn't work properly. When i'm trying to initialize OpenGl machine with this code (inside TCuboid construcor):m_gHDC = GetDC( hwnd ); //identifier (window HWND) SetupPixelFormat(); m_hRC = wglCreateContext( m_gHDC ); //identifier (OpenGL graphic context)
the variable: m_hRC is NULL and it shouldn't be. I've tried my class code with other IDE and all was fine. So i think the problem is with getting panel's HWND. Can somebody help me please? -- modified at 9:52 Sunday 14th October, 2007