GetDC() DllImport for x64 apps
Posted
by devdept
on Stack Overflow
See other posts from Stack Overflow
or by devdept
Published on 2010-03-11T21:12:45Z
Indexed on
2010/03/11
21:14 UTC
Read the original article
Hit count: 350
If you make a little research on the internet you'll see many DLLImport styles for this user32.dll function:
HDC GetDC(HWND hWnd);
The question is: what type is more appropriate for .NET x64 apps (either compiled with the Platform target as AnyCPU on a x64 machine or specifically as x64)? IntPtr for example grows to a size of 8 on a x64 process, can this be a problem? Is uint more appropriate than Uint64? What is the size of the pointers this function uses when used in a x64 process? The DLL is called user32.dll does it work as 32bit or 64bit on a x64 operating system?
[DllImport("user32.dll",EntryPoint="GetDC")]
public static extern IntPtr GetDC(IntPtr hWnd);
public static extern uint GetDC(uint hWnd);
public static extern int GetDC(int hWnd);
Thanks!
© Stack Overflow or respective owner