System::IntPtr to HDC

  • Thread starter Thread starter Manuel Costa
  • Start date Start date
I think that i have a compilation problem by mixing old code with new
directives for .net. (HDC)(int) returns an undifined value.
Any guess or suggestion to trace down the problem and find a possible
workaround?

manuel
 
See below:

HWND hwnd = (HWND)textBox1->Handle.ToPointer();
HDC hdc = GetDC(hwnd);
IntPtr dc = hdc;
HDC hdc_ = (HDC)dc.ToPointer();
ReleaseDC(hwnd, hdc_);

XXXPtr value types have a "ToPointer()" method, which give you a
"void*". You can convert void* to HWND, or HDC, which are actually
void*.

Ismail
 
It does not work.
Casting to HDC gives me an undifined value.
In this project i had some other weird problems like a stack overflow when a
specific constructor was invoked. I'm almost sure it is a problem with the
default directives for the .net compliance.

manuel
 
Back
Top