PDA

View Full Version : opengl with c++ .Net windows form



avihai
09-04-2003, 12:59 AM
I'm trying to show graphics using opengl on a control on a windows form in visual c++ .net
the controls I use are a picture box or a panel control.
the problem is the hwnd and hdc i can get are of type IntPtr. therefore, the wglCreateContext function doesn't work.
anyone knows how to convert IntPtr to HDC or another function that can be used???

[This message has been edited by avihai (edited 09-04-2003).]

grisha
09-04-2003, 09:05 AM
I'm trying to show graphics using opengl on a control on a windows form in visual c++ .net
the controls I use are a picture box or a panel control.
the problem is the hwnd and hdc i can get are of type IntPtr. therefore, the wglCreateContext function doesn't work.
anyone knows how to convert IntPtr to HDC or another function that can be used???
[/QUOTE]

All you need is hwnd:

unsigned int hwnd = (unsigned int)(control->Handle).ToInt32();

After that you can use GetDC() functions from WinAPI.