Use FindWindow to SetForgroundWindow
// For Windows Mobile, replace user32.dll with coredll.dll
[DllImport("coredll.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
Set text of ur frmMainMenu1.cs suppose "MainMenu" and call them at proper place
public int FindWindow(string windowName, bool wait)
{
int hWnd = FindWindow(null, windowName).ToInt32();
while (wait && hWnd == 0)
{
System.Threading.Thread.Sleep(500);
hWnd = FindWindow(null, windowName).ToInt32();
}
return hWnd;
}
And call this
int hWnd = FindWindow("MainMenu", wait);
if (hWnd != 0)
{
return SetForegroundWindow((IntPtr)hWnd);
}