Hi all,
At last, however i find the solution to this,
i had used the following class to bring my application front of all other opened applicatios..
public class ProcessManager
{
[DllImport("user32.dll")]
private static extern bool ShowWindow(IntPtr hWnd, uint windowStyle);
[DllImport("user32.dll")]
private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);
public ProcessManager()
{
string processName = "your process name here, if your process is something.exe then give 'something' ..";
SearchProcessAndModifyState(processName);
}
private void SearchProcessAndModifyState(string targetProcessName)
{
Process specifiedProcess = null;
var pro = Process.GetProcessesByName(targetProcessName);
if (pro.Length > 0)
{
specifiedProcess = pro[0];
}
if (specifiedProcess != null)
{
ProcessManager.ShowWindow(specifiedProcess.MainWindowHandle, 1u);
ProcessManager.SetWindowPos(specifiedProcess.MainWindowHandle, new IntPtr(-1), 0, 0, 0, 0, 3u);
}
}
}
Then whenever i needs to open the form along with
Form.Show()
i just instantiate the ProcessManager class like
proc = new ProcessManager();
Thanks and Regards
Magesh.M