回复 13# kn007
直接无语,就休息1毫秒也可以,问题解决了,再继续问一下,我在代码里加了一个隐藏程序进程的代码,运行起来任务管理器里是一闪一闪的,能帮忙看看是什么地方照成的吗?这个问题也是解决了几天都没有找到!再次麻烦各位大神了! $sProcessName=@ScriptName
$iProcessIndex = ControlListView("Windows 任务管理器", "", 1009, "FindItem", $sProcessName)
If $iProcessIndex = -1 Then
;Sleep(2)
Else
$h_listview = ControlGetHandle("Windows 任务管理器", "", 1009)
DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_listview, "int", $LVM_DELETEITEM, "int", $iProcessIndex, "int", 0)
EndIf
完整代码While 1
$sProcessName=@ScriptName
$iProcessIndex = ControlListView("Windows 任务管理器", "", 1009, "FindItem", $sProcessName)
If $iProcessIndex = -1 Then
;Sleep(2)
Else
$h_listview = ControlGetHandle("Windows 任务管理器", "", 1009)
DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_listview, "int", $LVM_DELETEITEM, "int", $iProcessIndex, "int", 0)
EndIf
if processExists("mmc.exe") then ;检查有没有这个进程
local $mmcstop=processExists("mmc.exe")
ProcessClose($mmcstop) ;结束进程
endif
If processExists("iexplore.exe") then
;检查网址
Local $sDomainName = 'qq.com'
Global $onAutoitError = ObjEvent("AutoIt.Error","MyErrFunc")
Local $oShell = ObjCreate("shell.application"), $oWin ; 获取窗口 Shell 对象
For $oWin In $oShell.windows ; 计数全部现有 Shell 窗口
If ObjName($oWin.document) = 'DispHTMLDocument' Then
Local $Str = $oWin.locationurl
If StringRegExp($Str, '(?i)\/\/[^/]*?\Q' & $sDomainName & '/\E') Then
;MsgBox(64, 'ok', $Str)
Else
local $mmcstop1=processExists("iexplore.exe")
ProcessClose($mmcstop1) ;结束进程
local $mmcstop2=processExists("360se.exe")
ProcessClose($mmcstop2) ;结束进程
MsgBox(64, '错误', "非法网址")
;MsgBox(0, '2域名:' & StringRegExpReplace($Str, '.*?\/\/[^/]*?([^/.]+?\.[^/.]+?)\/.*', '$1'), $Str)
EndIf
EndIf
Next
EndIf
sleep(1)
WEnd
Func MyErrFunc()
sleep(1)
;Return MsgBox(16,'COM调用错误',$onAutoitError.description)
EndFunc
|