Posts: 528
Threads: 50
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: Oct 2011
Reputation:
0
I have atm this code, that Start lcsm if this not exist in taskmngr.
While 1
While ProcessExists("lcsm.exe") ----> Here can be Connector.exe too.
Sleep(100)
WEnd
Sleep(30)
Run( "lcsm")
Do
Sleep(100)
Until ProcessExists("lcsm.exe")
WEnd
But, i wanna to write a Programm, who restart the Server then the Connector or/and Gameserver Crashs.
A Friend send me something like this :
f _NotResponding("C:\Users\Desktop\LCSM\Connector\Connector.exe", 1) Then; The last parameter indicates whether you want to close the hung app or not.
MsgBox(0,"Restart Server", "Restart Biw")
Else
MsgBox(0,"", "Application running as intended.")
EndIf
Func _NotResponding($title, $text, $closeIfHung = 0)
$hWnd = WinGetHandle($title, $text)
If $hWnd == "C:\Users\Desktop\LCSM\Connector\Connector.exe" Then
MsgBox(0,"Error","Could not find window")
Exit
EndIf
$retArr = DllCall("user32.dll", "int", "IsHungAppWindow", "hwnd", $hWnd)
If @error == 0 Then
If $retArr[0] == 1 Then
If $closeIfHung Then
ProcessClose(WinGetProcess($title, $text))
EndIf
Return 1
EndIf
Else
Return 0
EndIf
EndFunc
But i cant handle with it i wanna a simple script^^
Posts: 313
Threads: 20
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: Jul 2011
Reputation:
0
First thing you forgot to write [AutoIt] on your title tag.
Your code has some problems.
1)It looks for LCSM.exe not Connector.exe
2)When the Connector is crashing will not close(the process will remain there).
3)You dont need this, because you have your second while:
Do
Sleep(100)
Until ProcessExists("lcsm.exe")
3)look if the Process is working using the code your fried gave you:
fisrt you need to get the process Handle, using WinGetProcess();:
Then you need to check the the process i s hung up(your friend gave you the code):
$retArr = DllCall("user32.dll", "int", "IsHungAppWindow", "hwnd", $hWnd);
If retArr then
ProcessClose("Connector.exe");
Run( "Connector.exe")
EndIf
Posts: 313
Threads: 20
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: Jul 2011
Reputation:
0
$Hwnd is the window handler, needed to check.
func getHandle($pid)
$list = WinList()
for $i = 1 to $list[0][0]
if(WinGetProcess($list[$i][1]) = $pid) Then
return $list[i][1]
endIf
Next
return 0
endFunc
Posts: 528
Threads: 50
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: Oct 2011
Reputation:
0
i make a new at the moment that handle with OllyDbg
Posts: 610
Threads: 13
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: Jun 2011
Reputation:
0
btw, someone, is there any language u dont know ? :O
Im sure he doesnt speak japanese yet.
(please tell me im right)