如何通过自己的程序让另外的程序窗口总在最后,比如我想用一个程序打开另外一个程序,但同时想使打开的窗口在总在最后,怎么做呀?

解决方案 »

  1.   


    你需要得到其它程序的窗口句柄(可以考虑FindWindow)
    SetWindowPos Function--------------------------------------------------------------------------------The SetWindowPos function changes the size, position, and Z order of a child, pop-up, or top-level window. Child, pop-up, and top-level windows are ordered according to their appearance on the screen. The topmost window receives the highest rank and is the first window in the Z order.SyntaxBOOL SetWindowPos(          HWND hWnd,
        HWND hWndInsertAfter,
        int X,
        int Y,
        int cx,
        int cy,
        UINT uFlags
    );
    ParametershWnd
    [in] Handle to the window.
    hWndInsertAfter
    [in] Handle to the window to precede the positioned window in the Z order. This parameter must be a window handle or one of the following values.
    HWND_BOTTOM
    Places the window at the bottom of the Z order. If the hWnd parameter identifies a topmost window, the window loses its topmost status and is placed at the bottom of all other windows.
    HWND_NOTOPMOST
    Places the window above all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window.
    HWND_TOP
    Places the window at the top of the Z order.
    HWND_TOPMOST
    Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.
    For more information about how this parameter is used, see the following Res section.
      

  2.   

    在 WinPinApp上好像有个 MakeAll WindowTop 工程,  生成文件叫 WinPinApp ,使用了dll可以使其他所有的窗体处于最上面不过我不晓得具体在哪个位置了
      

  3.   

    晕 网址是:http://www.codeproject.com