i have that code that works fine in restoring a window(window in minimize mode) but when i didn't minimize the application just lost the focus it will not bring to front i tried all the combination of command show but still no luck.Code:[DllImport("user32")] public static extern int ShowWindow(int hwnd, int nCmdShow); [DllImport("user32")] public static extern int UpdateWindow(int hwnd); Process[] p = Process.GetProcessesByName("WindowsApplication4"); int i=int.Parse(p[0].MainWindowHandle.ToString()); if(i != 0) { ShowWindow(i,9); UpdateWindow(i); }
Code:hwnd The handle of the window to change the show status of. nCmdShow Exactly one of the following flags specifying how to show the window: SW_HIDE = 0 Hide the window. SW_MAXIMIZE = 3 Maximize the window. SW_MINIMIZE = 6 Minimize the window. SW_RESTORE = 9 Restore the window (not maximized nor minimized). SW_SHOW = 5 Show the window. SW_SHOWMAXIMIZED = 3 Show the window maximized. SW_SHOWMINIMIZED = 2 Show the window minimized. SW_SHOWMINNOACTIVE = 7 Show the window minimized but do not activate it. SW_SHOWNA = 8 Show the window in its current state but do not activate it. SW_SHOWNOACTIVATE = 4 Show the window in its most recent size and position but do not activate it. SW_SHOWNORMAL = 1 Show the window and activate it (as usual).




Reply With Quote