Windows Develop Bookmark and Share   
 index > Windows Forms General > want to minimize application from another application
 

want to minimize application from another application

Hi,

I want to minimize application from another application. I have one applicaiton named app1.

and other appplication named app2. When user performs minimize on app1, app2 should also get minimized.

Please tell me how to do it?

Can I used SendMessage API. Please provide samples if possible...

codingispassion  Monday, January 08, 2007 4:06 AM

Hi,

You need to use Win32 API for that,

On minimize of first application,

ShowWindow(ipHandle,WindowShowStyle.Minimize); to minimize and

ShowWindow(ipHandle,WindowShowStyle.Restore); to restore it again

Where,
Declared method and enum,

[DllImport("user32.dll")]
internal static extern bool ShowWindow(IntPtr hWnd, WindowShowStyle nCmdShow);

internal enum WindowShowStyle : uint
{
Minimize = 6,
Restore = 9,
}

and

ipHandle is Process.MainWindowHandle
[
You will need to get process object using something like,
Process app2 = Process.GetProcessesByName(strApp2ProcessName)and then get
handle by
app2.MainWindowHandle and pass that in above method
]

HTH,

Indian Ocean  Monday, January 08, 2007 9:42 AM

Hi,

You need to use Win32 API for that,

On minimize of first application,

ShowWindow(ipHandle,WindowShowStyle.Minimize); to minimize and

ShowWindow(ipHandle,WindowShowStyle.Restore); to restore it again

Where,
Declared method and enum,

[DllImport("user32.dll")]
internal static extern bool ShowWindow(IntPtr hWnd, WindowShowStyle nCmdShow);

internal enum WindowShowStyle : uint
{
Minimize = 6,
Restore = 9,
}

and

ipHandle is Process.MainWindowHandle
[
You will need to get process object using something like,
Process app2 = Process.GetProcessesByName(strApp2ProcessName)and then get
handle by
app2.MainWindowHandle and pass that in above method
]

HTH,

Indian Ocean  Monday, January 08, 2007 9:42 AM
Thanks man..........:-)
codingispassion  Monday, January 08, 2007 12:47 PM

You can use google to search for other answers

Custom Search

More Threads

• Linking to a resource file within the WebBrowser object
• Hidden parent, visible child, VisibleChanged
• how to change font size in code?
• converting an MS-DOS/C++ program to Windows/C#
• How to modify Windows Form Designer Generated code In InitializeComponent() method programmitically?
• Filling DataGridView
• TableLayoutPanel Height
• Embedding a control inside a toolbar
• How to get the mousedown event of a form even when a child control ist clicked
• how to hide the vertical scrollbar of the listbox