Multiboxing.com - Multiboxing in World of Warcraft and more!
          

Go Back   Multiboxing in World of Warcraft and Beyond! > All Gaming Forums > World of Warcraft - Macros, UIs, Mods, Addons

Reply
 
LinkBack Thread Tools Display Modes
Old 06-12-2011, 07:41 AM   #1
Junior Member
 
Join Date: Jul 2010
Posts: 1
Default Disable Alt+F4 (oops!) using AutoIT

Code:
; disable alt-f4 for wow - jason@godsey.net / binutils
; To end this script, right click quit on icon is systray or ctrl+alt+f4


; **********************************
; EDIT THIS STRING to make changes to the list of titles to ignore Alt+F4
; **********************************

Global $DisableAltF4List = "World of Warcraft; SciTE4AutoIt3; UltraEdit";

Global $Debug = true;  ; Set to false if you don't want the splash screen popups when Alt+F4 is caught

; ***** The rest of the script should be ok to simply ignore

Opt("WinTitleMatchMode",4)
Opt("WinSearchChildren",1)

HotKeySet("!{F4}", "DisableAltF4");
HotKeySet("^!{F4}", "QuitDisableAltF4");

Func _SendMessage($hWnd, $msg, $wParam = 0, $lParam = 0, $r = 0, $t1 = "int", $t2 = "int")
    Local $ret = DllCall("user32.dll", "long", "SendMessage", "hwnd", $hWnd, "int", $msg, $t1, $wParam, $t2, $lParam);
    If @error Then Return SetError(@error, @extended, "");
    If $r >= 0 And $r <= 4 Then Return $ret[$r];
    Return $ret;
EndFunc 


Func OnLoadDisableAltF4()
	SplashTextOn("Disable Alt+F4", @CRLF & "Disable Alt+F4 by binutils Loaded" & @CRLF & @CRLF & "Press Ctrl+Alt+F4 to Exit this script." & @CRLF & @CRLF & "Current List of Window Titles to ignore Alt+F4" & @CRLF & @CRLF & "(edit this script to change)" & @CRLF & @CRLF & $DisableAltF4List );
	Sleep(2500);
	SplashOff();	
EndFunc

Func QuitDisableAltF4()
	SplashTextOn("Disable Alt+F4", @CRLF & "Disable Alt+F4" & @CRLF & @CRLF & "Exiting");
	Sleep(1000);
	SplashOff();
	Exit
EndFunc

Func DisableAltF4()
	
	Global $DisableAltF4List;
	
	$Current = WinGetHandle("[active]");

	Local $i;
	Local $Pass = true;   ; Default to passing unless we match a title givein in the DisableAltF4List

	Local $DisableList = StringSplit($DisableAltF4List, ";");
	
	If IsArray($DisableList) Then
		For $i = 1 to UBound($DisableList) - 1
;			MsgBox(0, "Test", "Testing " & WinGetTitle($Current) & " against " & $DisableList[$i]);
			If (StringRegExp(WinGetTitle($Current), StringStripWS($DisableList[$i], 3), 0)) Then
				$Pass = false;
			EndIf
		Next		
	EndIf
	
	If ($Pass == true) Then
		; We didn't match any titles so pass the kill message along to the application
		_SendMessage($Current, 0x10, 0, 0);	  ; Windows WM_CLOSE 0x10 message
		If ($Debug == true) Then
			SplashTextOn("Disable Alt+F4", "Intercepted Alt+F4" & @CRLF & @CRLF & WinGetTitle($Current) & @CRLF & @CRLF & "Killed");
			WinActivate($Current);
			Sleep(200);
			SplashOff();
		EndIf
	Else
		If ($Debug == true) Then
			SplashTextOn("Disable Alt+F4", "Intercepted Alt+F4" & @CRLF & @CRLF & WinGetTitle($Current) & @CRLF & @CRLF & "Ignoring");
			WinActivate($Current);
			Sleep(200);
			SplashOff();
		EndIf
	EndIf
	
	Return;
	
EndFunc

OnLoadDisableAltF4();

While (1=1)
	Sleep(500);
WEnd
binutils is offline   Reply With Quote
Reply

Tags
alt+f4, altf4, autoit

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't disable LUA errors? Tim General Discussions 15 03-03-2011 01:36 PM
Need a macro to enable/disable auto-loot Janus World of Warcraft - Macros, UIs, Mods, Addons 3 01-31-2011 09:42 PM
Disable sound not working on slaves? Heartspark Multiboxing Software 15 02-06-2010 05:26 PM


SEO by vBSEO 3.3.2