Maximize an other application from my csharp application

P

peetersb

Hello,

I want to maximize an other running application from my C#
application.
First I want tot test if the application is running, and then maximize
it from my csharp application.
How can I do that?

Thanks
Bart
 
K

kimiraikkonen

Hello,

I want to maximize an other running application from my C#
application.
First I want tot test if the application is running, and then maximize
it from my csharp application.
How can I do that?

Thanks
Bart

You can use ShowWindow API via P/invoke. And use GetProcessByName from
Process class in a for-each loop then call ShowWindow function API.

For decleration more info:
http://www.pinvoke.net/default.aspx/user32/ShowWindow.html

After declaring API, simply use:
// For example maximize notepad
foreach (Process p in Process.GetProcessesByName("notepad"))
{
ShowWindow(p.MainWindowHandle, SHOW_WINDOW.SW_MAXIMIZE);
}



Thanks,

Onur Güzel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top