如何通过自己的程序让另外的程序窗口总在最后

jianxuan 2005-06-23 06:28:00
如何通过自己的程序让另外的程序窗口总在最后,比如我想用一个程序打开另外一个程序,但同时想使打开的窗口在总在最后,怎么做呀?
...全文
87 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
DentistryDoctor 2005-06-24
  • 打赏
  • 举报
回复

你需要得到其它程序的窗口句柄(可以考虑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.

Syntax

BOOL SetWindowPos( HWND hWnd,
HWND hWndInsertAfter,
int X,
int Y,
int cx,
int cy,
UINT uFlags
);
Parameters

hWnd
[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 Remarks section.


CodeKey 2005-06-24
  • 打赏
  • 举报
回复
晕 网址是:http://www.codeproject.com
CodeKey 2005-06-24
  • 打赏
  • 举报
回复
在 WinPinApp上好像有个 MakeAll WindowTop 工程, 生成文件叫 WinPinApp ,使用了dll

可以使其他所有的窗体处于最上面

不过我不晓得具体在哪个位置了
qrlvls 2005-06-24
  • 打赏
  • 举报
回复
up
oyljerry 2005-06-23
  • 打赏
  • 举报
回复
控制焦点
newbiestar 2005-06-23
  • 打赏
  • 举报
回复
是让自己的总在最前还是让新建的程序总在最后啊?这个差别可不小啊……

15,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧