找回密码
 加入
搜索
查看: 2591|回复: 6

[AU3基础] 只有进程ID这个条件,如何激活这个应用程序的窗口?

  [复制链接]
发表于 2012-4-13 23:29:46 | 显示全部楼层 |阅读模式
RT。
这个应用程序确实有窗口,只是用最小化后,隐藏起来了,任务栏里找不到,只好靠其他第三方程序激活,求思路~
发表于 2012-4-14 00:09:12 | 显示全部楼层
本帖最后由 user3000 于 2012-4-15 07:39 编辑

回复 1# xwt620
借鉴7楼蛋大的代码(他的代码, 经测试失败了), 修改了下:
获取进程窗口句柄, 然后就可以进行激活等操作了:
#include <WinAPIEx.au3>
$PID = ProcessExists('sfdsf.exe')
$a = _WinAPI_EnumProcessWindows($PID, 0)
If IsArray($a) Then
        For $i = 1 To $a[0][0]
                _WinAPI_ShowWindow($a[$i][0], @SW_SHOW)
        Next
EndIf
此代码, 无标题的隐藏窗口也可显示!
经测试, 它可以显示隐藏的无标题AU3窗口, 但很奇怪, 会多显示1个标题为'AutoIt V3' 的窗口.
如果把该窗口关掉, 也就把AU3程序关了!
发表于 2012-4-14 00:18:57 | 显示全部楼层
二楼好方法  mark 一下
 楼主| 发表于 2012-4-14 13:26:12 | 显示全部楼层
回复 2# user3000


    试了一下报错哦~
发表于 2012-4-14 17:46:04 | 显示全部楼层
回复 4# xwt620
二楼代码是有误, GuiSetState 对不是同一程序的窗口也不起作用.
试试这个, 枚举窗口标题后, 判断同 PID 则...
#include <WinAPIEx.au3>
$PID = ProcessExists('toolmgr.exe')
$b = WinList()
For $ii = 1 To $b[0][0]
        $_pid = WinGetProcess($b[$ii][0])
        If $_pid = $PID Then
                WinSetState($b[$ii][0], '', @SW_RESTORE)
                WinSetState($b[$ii][0], '', @SW_SHOW)
        EndIf
Next
发表于 2012-4-15 01:41:15 | 显示全部楼层
楼主什么软件 分享一下
发表于 2012-4-15 02:12:00 | 显示全部楼层
本帖最后由 netegg 于 2012-4-15 02:55 编辑

#Include <WinAPIEx.au3>
$ahWnd = _WinAPI_EnumProcessWindows( $PID, False )
if isarray($ahWnd) then
  for $hWnd in $ahWnd
     _WinAPI_ShowWindow($hWnd)
  next
endif
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-8 23:37 , Processed in 0.079440 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表