IntPtr hdc = GetDC(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle); works in .Net console applications just fine.
I do not believe that it nullwill work in .Net, since it launches Error, Argument: it is impossible to convert from '<null>'to'System.IntPtr'
source
share