getWindowDC vs Process.Handle

  • Thread starter Thread starter Sephi berry via .NET 247
  • Start date Start date
S

Sephi berry via .NET 247

Hi
I'm having this problem of accessing the handle of a window.
I retrive it by:
Dim procs As Process() = Process.GetProcessesByName("ArcScene")
dim intHWND1 IntPtr = procs(0).Handle

and get a number BUT when i try to get a screenshot with
...
Dim hdcSrc As IntPtr = User32.GetWindowDC(handle)
...
I get Zero !

Any suggstions would be appriciated,
thanks
Sephi
 
* Sephi berry via .NET 247 said:
I'm having this problem of accessing the handle of a window.
I retrive it by:
Dim procs As Process() = Process.GetProcessesByName("ArcScene")
dim intHWND1 IntPtr = procs(0).Handle

Notice that 'procs(0).Handle' returns a process handle, but
'GetWindowDC' requires a window handle. You can use
'procs(0).MainWindowHandle' to get a handle to the process' main window
handle, and then pass this handle to 'GetWindowDC'.
 
Back
Top