执行一个外部的exe文件,如何使其再次成为当前激活窗体?

jackystar 2004-08-16 07:50:55
在当前应用上鼠标点一下躲到后面以后,要使那个外部的EXE文件成为当前激活的窗体
我用SendMessage(AHandle,WM_Activate,MakewParam(Wa_Active,0),0); 只有第一次可以出来,以后就没反应了,而且每次的返回值也都是O
...全文
236 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
jackystar 2004-08-18
  • 打赏
  • 举报
回复
SendMessage 也一样 :(
linzhengqun 2004-08-17
  • 打赏
  • 举报
回复
要使其成为激活窗口,为什么不用:
SetActiveWindow呢
hy1080 2004-08-17
  • 打赏
  • 举报
回复
学习
linzhengqun 2004-08-17
  • 打赏
  • 举报
回复
那就在SetActiveWindow后再加一句
PostMessage(Ahandle,WM_SYSCOMMAND,SC_RESTORE,0);
不就行了
jackystar 2004-08-17
  • 打赏
  • 举报
回复
但窗口如果最小化,就弹不出来了 :(
whitetiger8 2004-08-17
  • 打赏
  • 举报
回复
SetActiveWindow函数可以实现 。 现成的API函数哦。
参数直接写想要激活的窗体的句柄就可以

The SetActiveWindow function activates a window.

HWND SetActiveWindow(

HWND hWnd // handle of window to activate
);


Parameters

hWnd

Identifies the top-level window to be activated.



Return Values

If the function succeeds, the return value is the handle of the window that was previously active.

Remarks

The SetActiveWindow function activates a window, but not if the application is in the background. The window will be brought into the foreground (top of Z order) if the application is in the foreground when it sets the activation.
If the window identified by the hWnd parameter was created by the calling thread, the active window status of the calling thread is set to hWnd. Otherwise, the active window status of the calling thread is set to NULL.

The SetForegroundWindow window function, on the other hand, activates a window and forces it into the foreground. An application should only call SetForegroundWindow if it needs to display critical errors or information that needs the user's immediate attention .
WuChenCan 2004-08-17
  • 打赏
  • 举报
回复
搜一下API函数吧!
linzhengqun 2004-08-17
  • 打赏
  • 举报
回复
这样啊,可惜我这里不能测试,
那你换成SendMessage看一下呀。
才子鸣 2004-08-17
  • 打赏
  • 举报
回复
不会,学习!
jackystar 2004-08-17
  • 打赏
  • 举报
回复
PostMessage(Ahandle,WM_SYSCOMMAND,SC_RESTORE,0);
这第一次有用,用过后,那个程序就再也不响应最小化消息了 :(

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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