Hi,
Call the SendMessage API function through P/Invoke, sending the WM_MAXIMIZE
message to the main process window. As you already have the MainWindowHandle
(you don't need to get a pointer from it, by the way), the rest is pretty
straightforward:
1) Declare the SendMessage prototype with the DllImport attribute (please
refer to MSDN for details on this)
2) Find out the numeric value of the WM_MAXIMIZE constant (look it up in the
winuser.h file. You should have one if you have Visual C++ installed)
3) Call the declared SendMessage method passing necessary parameters.
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"Sanjay Seshasainam" <sa************@yahoo.com> wrote in message
news:07****************************@phx.gbl...
How can I maximize a process window
I am using the Process class in System.Diagnostics. I can
identify the specific process I want using the window
title after that I want to maximize the window. I can get
the handle for the window using MainWindowHandle how do I
maximize the window ?
Thanks,
Sanjay
Process[] myProcess;
myProcess = Process.GetProcessesByName("process_name");
foreach (System.Diagnostics.Process instance in
myProcess)
{
string windowTitle = instance.MainWindowTitle;
if ( windowTitle == "WINDOW_TITLE" )
{
// How can I maximize the window here ??
void *windowHandle =
instance.MainWindowHandle.ToPointer();
}
}