Getting HWND of Console (.net 2.0)

  • Thread starter Thread starter Michael D. Ober
  • Start date Start date
M

Michael D. Ober

I need to get the HWND of a console application so I can use the Windows API
functions to control window position. The console class doesn't provide
full control over a window's position and whether or not it's minimized,
restored, or maximized.

Mike Ober.
 
You can use Win32 API

[DllImport("kernel32")]

internal static extern IntPtr GetConsoleWindow();

for this



HTH

Alex
 
Thanks - I wasn't sure how to reference the API call itself.

Mike.

AlexS said:
You can use Win32 API

[DllImport("kernel32")]

internal static extern IntPtr GetConsoleWindow();

for this



HTH

Alex

Michael D. Ober said:
I need to get the HWND of a console application so I can use the Windows
API
functions to control window position. The console class doesn't provide
full control over a window's position and whether or not it's minimized,
restored, or maximized.

Mike Ober.
 
Back
Top