去HELP索引中Control开头的都看一变
xxoojoeooxx 发表于 2011-4-3 18:31
感谢您,已搞定这个控件隐藏,如下,但就是RUN这个计算器的时候,却不能最小化运行,所以出现窗口会闪一下,有点那个啥。。。能再帮忙看一下么?
$iPid=Run("calc.exe",@SystemDir,@SW_MINIMIZE) ;似乎有些可以最小化运行,有些不行,比如画图程序就可以这样来最小化运行,但计算器不成
$iPid=_ProcessGetHWnd($iPid) ;通过PID来获取窗口句柄
WinSetTitle($iPid, "", "test") ;修改目标窗口标题
WinSetState ($iPid, "",@SW_SHOW)
;下边比如要将计算器窗口上的 “= ”键@SW_HIDE掉,或者改为其它任何字符。。。。谢谢
ControlHide ($iPid, "",112)
ControlHide ($iPid, "",92)
Func _ProcessGetHWnd($iPid, $iOption = 1, $sTitle = "", $iTimeout = 2000)
Local $aReturn[1][1] = [[0]], $aWin, $hTimer = TimerInit()
While 1
; Get list of windows
$aWin = WinList($sTitle)
; Searches thru all windows
For $i = 1 To $aWin[0][0]
; Found a window owned by the given PID
If $iPid = WinGetProcess($aWin[$i][1]) Then
; Option 0 or 1 used
If $iOption = 1 OR ($iOption = 0 And $aWin[$i][0] <> "") Then
Return $aWin[$i][1]
; Option 2 is used
ElseIf $iOption = 2 Then
ReDim $aReturn[UBound($aReturn) + 1][2]
$aReturn[0][0] += 1
$aReturn[$aReturn[0][0]][0] = $aWin[$i][0]
$aReturn[$aReturn[0][0]][1] = $aWin[$i][1]
EndIf
EndIf
Next
; If option 2 is used and there was matches then the list is returned
If $iOption = 2 And $aReturn[0][0] > 0 Then Return $aReturn
; If timed out then give up
If TimerDiff($hTimer) > $iTimeout Then ExitLoop
; Waits before new attempt
Sleep(Opt("WinWaitDelay"))
WEnd
; No matches
SetError(1)
Return 0
EndFunc ;==>_ProcessGetHWnd
|