mesale0077 Posted January 19, 2013 Share Posted January 19, 2013 (edited) Edited September 4, 2014 by mesale0077 Quote Link to comment Share on other sites More sharing options...
blue_life Posted January 19, 2013 Share Posted January 19, 2013 OnAutoItExitRegister("_Shutdown") Local $Form1 = GUICreate("Form1", 400, 200) GUISetState(@SW_SHOW) Do Sleep(50) Until GUIGetMsg() = -3 Func _Shutdown() Switch @exitMethod Case 0 MsgBox(64, "Info:", 'Natural closing.') Case 1 MsgBox(64, "Info:", 'close by Exit function.') Case 2 MsgBox(64, "Info:", 'close by clicking on exit of the systray.') Case 3 MsgBox(64, "Info:", 'close by user logoff.') Case 4 MsgBox(64, "Info:", 'close by Windows shutdown.') EndSwitch EndFunc ;==>_Shutdown Kolay gelsin.... Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted January 19, 2013 Author Share Posted January 19, 2013 (edited) sizede kolay gelsin hocam sağolun hocam Edited January 19, 2013 by mesale0077 Quote Link to comment Share on other sites More sharing options...
blue_life Posted January 19, 2013 Share Posted January 19, 2013 Doğru komutları bulmuşsun! Nerde takıldın... Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted January 19, 2013 Author Share Posted January 19, 2013 (edited) pc kapattığımız da yada yeniden başlatırken işlem yaptıracağım ama işlem bitincede pc kapanması lazım mesala takılı usb oldugunu uyarması temp klasörünü temizleme yada pc kapanma saat gibi logu tutma gibi işlemler yapmak istiyorum bir örnek paylaşırmısın uygun kodlardan hangisini önerirseniz Edited January 19, 2013 by mesale0077 Quote Link to comment Share on other sites More sharing options...
blue_life Posted January 19, 2013 Share Posted January 19, 2013 Ikinci koda daha önce bakmıştım ve pc ayarlarını bozmaz... Neyse sana sade bir örnek vereyim, sen biraz kurcalarsın.Benim kaçmam gerekiyor, kolay gelsin... Global $ShutDown = False _shutdown_block() While 1 Sleep(100) If $ShutDown = True Then MsgBox(64,"Blue_Test","Istediğin kodları ekleyip sonra autoit ile bilgisayarı kapatabilirsin. vs. vs.") Shutdown(5) EndIf WEnd Func _shutdown_block() Local $shgui = GUICreate("", 5, 5, -100, -100) If NOT _setprocessshutdownparameters(4095) Then If NOT _setprocessshutdownparameters(1279) Then _setprocessshutdownparameters(1023) EndIf EndIf GUIRegisterMsg(17, "Cancel_Shutdown") DllCall("User32.dll", "int", "ShutdownBlockReasonCreate", "int", $shgui, "wstr", "Blue Test...") DllCall("kernel32.dll", "int", "SetThreadExecutionState", "int", BitOR(-2147483648, 2, 1)) EndFunc Func cancel_shutdown($hwndgui, $msgid, $wparam, $lparam) If $ShutDown = False Then $ShutDown = True Return False EndIf Return True EndFunc Func _setprocessshutdownparameters($dwlevel, $dwflags = 0) Local $aresult = DllCall("Kernel32.dll", "int", "SetProcessShutdownParameters", "dword", $dwlevel, "dword", $dwflags) If @error Then Return SetError(1, 0, 0) Return $aresult[0] EndFunc Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted January 19, 2013 Author Share Posted January 19, 2013 (edited) çok sağolun hocam Edited January 19, 2013 by mesale0077 Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted January 19, 2013 Author Share Posted January 19, 2013 Ikinci koda daha önce bakmıştım ve pc ayarlarını bozmaz... Neyse sana sade bir örnek vereyim, sen biraz kurcalarsın. Benim kaçmam gerekiyor, kolay gelsin... Global $ShutDown = False _shutdown_block() While 1 Sleep(100) If $ShutDown = True Then MsgBox(64,"Blue_Test","Istediğin kodları ekleyip sonra autoit ile bilgisayarı kapatabilirsin. vs. vs.") Shutdown(5) EndIf WEnd Func _shutdown_block() Local $shgui = GUICreate("", 5, 5, -100, -100) If NOT _setprocessshutdownparameters(4095) Then If NOT _setprocessshutdownparameters(1279) Then _setprocessshutdownparameters(1023) EndIf EndIf GUIRegisterMsg(17, "Cancel_Shutdown") DllCall("User32.dll", "int", "ShutdownBlockReasonCreate", "int", $shgui, "wstr", "Blue Test...") DllCall("kernel32.dll", "int", "SetThreadExecutionState", "int", BitOR(-2147483648, 2, 1)) EndFunc Func cancel_shutdown($hwndgui, $msgid, $wparam, $lparam) If $ShutDown = False Then $ShutDown = True Return False EndIf Return True EndFunc Func _setprocessshutdownparameters($dwlevel, $dwflags = 0) Local $aresult = DllCall("Kernel32.dll", "int", "SetProcessShutdownParameters", "dword", $dwlevel, "dword", $dwflags) If @error Then Return SetError(1, 0, 0) Return $aresult[0] EndFunc hocam izniniz olursa bu şekilde değiştirdim kodda küçük bir sorun oluşmuştu şu şekil yapınca düzeldi çok sağolun yardımlarınız için bu şekil sorunsuz bende çalışmaktadır Global $ShutDown = False Local $shgui = GUICreate("", 5, 5, -100, -100) GUISetSTate(@SW_HIDE) _shutdown_block() While 1 Sleep(100) If $ShutDown = True Then MsgBox(64,"Blue_Test","Istediğin kodları ekleyip sonra autoit ile bilgisayarı kapatabilirsin. vs. vs.") _ShutdownBlockReasonDestroy($shgui) Shutdown(5) exit EndIf WEnd Func _shutdown_block() If NOT _setprocessshutdownparameters(4095) Then If NOT _setprocessshutdownparameters(1279) Then _setprocessshutdownparameters(1023) EndIf EndIf GUIRegisterMsg(17, "Cancel_Shutdown") DllCall("User32.dll", "int", "ShutdownBlockReasonCreate", "int", $shgui, "wstr", "Blue Test...") DllCall("kernel32.dll", "int", "SetThreadExecutionState", "int", BitOR(-2147483648, 2, 1)) EndFunc Func cancel_shutdown($hwndgui, $msgid, $wparam, $lparam) If $ShutDown = False Then $ShutDown = True Return False EndIf Return True EndFunc Func _setprocessshutdownparameters($dwlevel, $dwflags = 0) Local $aresult = DllCall("Kernel32.dll", "int", "SetProcessShutdownParameters", "dword", $dwlevel, "dword", $dwflags) If @error Then Return SetError(1, 0, 0) Return $aresult[0] EndFunc Func _ShutdownBlockReasonDestroy($hWnd) Local $aResult = DllCall("User32.dll", "int", "ShutdownBlockReasonDestroy", "hwnd", $hWnd) If @error Then Return SetError(1, 0, 0) Return $aResult[0] EndFunc ;==>_ShutdownBlockReasonDestroy Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.