Results 1 to 2 of 2

Thread: ShowWindow can't bring to front[Resolved]

Threaded View

  1. #1

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Resolved ShowWindow can't bring to front[Resolved]

    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);
    }
    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:
    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).
    Last edited by mar_zim; Aug 23rd, 2005 at 08:41 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width