Home All Groups Group Topic Archive Search About

Checking the window state of a running process.

Author
15 Apr 2005 1:57 PM
bamapookie
What is the best way to check and change the window state of a process
given either a System.Diagnostics.Process or a MainWindowHandle?  I was
using the following commands, but hide is not working for some reason.

ShowWindow(prTarget.MainWindowHandle, SW.HIDE) ' This doesn't always
work
SendMessage(prTarget.MainWindowHandle, WM.SYSCOMMAND, SC.MAXIMIZE, 0)
SendMessage(prTarget.MainWindowHandle, WM.SYSCOMMAND, SC.MINIMIZE, 0)
SendMessage(prTarget.MainWindowHandle, WM.SYSCOMMAND, SC.RESTORE, 0)

Note that prTarget is of type System.Diagnostics.Process.
SW, WM, and SC are enums with the appropriately defined values.

Author
15 Apr 2005 10:05 PM
Crouchie1998
This is a repost I think from around 4 days ago

Crouchie1998
BA (HONS) MCP MCSE