wraithdu Posted October 13, 2009 Posted October 13, 2009 (edited) Hmmm, another interesting problem with the newest version. Unsetting the event kills the array. Maybe make a local copy of the array in the handler function somewhere? That could suck for performance though. $iExit = False _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_CrashMe") Do Sleep(1000) Until $iExit Exit Func _CrashMe() _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT) $iExit = True EndFunc I really think it's better if you just give the users a little responsibility, and go back to the version without the timers. Edited October 13, 2009 by wraithdu
MrCreatoR Posted October 14, 2009 Author Posted October 14, 2009 (edited) another interesting problem with the newest version. Unsetting the event kills the array. Maybe make a local copy of the array in the handler function somewhere?No need to, i can just chek the array dimensions: If Number($__MouseSetOnEvent_aEvents[0][0]) >= $i Then If $__MouseSetOnEvent_aEvents[$i][5] = -1 Then Return $iRet Return $__MouseSetOnEvent_aEvents[$i][5] ;Block default processing (or not :)) EndIf I really think it's better if you just give the users a little responsibility, and go back to the version without the timers.But i want to let the users have that ability, to unset the event every time they want, even if the event will be unset only after the function is return. But yes, in any case i should put a small note about this issue, so users will know that unsetting last event in callback function is impossible, so it's not a good idea. P.S Or i have another idea/question - what if i just leave the callback always set? then i will not have to unset it every time, and all those issues are gone - but the main question here is this a proper way to handle callbacks, is this will make the app that uses it to use more system resources? Edited October 14, 2009 by MrCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
wraithdu Posted October 14, 2009 Posted October 14, 2009 Only problem with just checking the array bounds is the user's preference for $iBlockDefProc is now lost. Maybe better is to save the value of [$i][5] to a variable before the Call() to the function, so even if the event is unset in the function, the desired $iBlockDefProc is saved. I'm like you though. Even though leaving the callback set until app exit is probably OK and its impact on performance is probably negligible, I don't like wasting resources on any level.
wraithdu Posted October 14, 2009 Posted October 14, 2009 Also this needs to be changed as follows: If $__MouseSetOnEvent_aEvents[0][0] < 1 Then If $__MouseSetOnEvent_iEventReturn = 1 Then OnAutoItExit() Else $__MouseSetOnEvent_iTimer = _Timer_SetTimer(0, 10, "__MouseSetOnEvent_WaitHookReturn") EndIf EndIf Otherwise OnAutoItExit() was called everytime an event was unset, even if it wasn't the last one.
MrCreatoR Posted October 14, 2009 Author Posted October 14, 2009 wraithduOk, updated in new version 1.7. If there will be more bugs, then i really set the callback globaly . Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
wraithdu Posted October 14, 2009 Posted October 14, 2009 The new v1.7 looks good, passed all my previous tests. Thanks!
dantay9 Posted November 8, 2009 Posted November 8, 2009 The $MOUSE_WHEELDBLCLK_EVENT doesn't work. I was trying to find out how to hook it and came upon your example. I did a bit more research and came up with this. It says that wParam cannot be $MOUSE_WHEELDBLCLK_EVENT. Is there any way to detect this event or do I have to use $MOUSE_WHEELDOWN_EVENT and a timer?
SEuBo Posted November 26, 2009 Posted November 26, 2009 Hey MrCreator,First of all: You're doing a great job! Anyway, I am encountering a really nasty bug. I could already reproduce it on several computers with different operating systems. Okey, let me explain: I am using your UDF for capturing Mousewheel events in my script. Best thing would be if you just try it out yourself:expandcollapse popup#include <MouseSetOnEvent_UDF.au3> #include <Misc.au3> _Singleton(@ScriptName) HotKeySet("{ESC}","_kill") HotKeySet("{PAUSE}","_toogle") $aDll = DllOpen("user32.dll") $aWin = @ScriptName $aVal = 15 $go = True While $go ;Setzt den Fenster-Handle neu, falls ein neues Fenster aktiv ist. If $aWin <> WinGetTitle("") Then $aWin = WinGetTitle("") EndIf ;Solange Strg gedrückt ist, werden die Events zugeordnet While _IsPressed(11, $aDll) ToolTip(WinGetTrans($aWin)) ; Zeigt die Transparenz des aktuellen Fensters _MouseSetOnEvent($MOUSE_WHEELSCROLLUP_EVENT, "_trans", "up", "") _MouseSetOnEvent($MOUSE_WHEELSCROLLDOWN_EVENT, "_trans", "down", "") If WinGetTrans($aWin) = -1 Then WinSetTrans($aWin,"",255) EndIf If _IsPressed(04, $aDll) Then ToolTip("") ;Entfernt Tool- und Traytip (sonst gibts hässliche schwarze Ränder) TrayTip("","",0) _RestoreTrans() EndIf Sleep(10) WEnd ;Wenn Strg nicht gedrückt, dann hebe die zuordnungen für die Mausrad events auf. _MouseSetOnEvent($MOUSE_WHEELSCROLLUP_EVENT, "") _MouseSetOnEvent($MOUSE_WHEELSCROLLDOWN_EVENT, "") ToolTip("") Sleep(10) WEnd Func _trans($wDir) If _IsPressed(11, $aDll) Then Switch $wDir Case "up" If _IsPressed(10, $aDll) Then ; Wenn Shift gedrückt gehalten wird, ändere nur die Transparenzschritte $aVal += 5 If $aVal > 255 Then $aVal = 255 TrayTip($aVal,"Transparenzschritte",1) Else ; Ansonsten ändere die Transparenz selbst. $aTrans = WinGetTrans($aWin) If ($aTrans + $aVal) > 255 OR $aTrans = -1 Then $aTrans = 255 Else $aTrans += $aVal EndIf WinSetTrans($aWin,"",$aTrans) EndIf Case "down" If _IsPressed(10, $aDll) Then ; Wenn Shift gedrückt gehalten wird, ändere nur die Transparenzschritte $aVal -= 5 If $aVal < 0 Then $aVal = 0 TrayTip($aVal,"Transparenzschritte",1) Else ; Ansonsten ändere die Transparenz selbst. $aTrans = WinGetTrans($aWin) If ($aTrans - $aVal) < 0 Then $aTrans = 0 Else $aTrans -= $aVal EndIf WinSetTrans($aWin,"",$aTrans) EndIf EndSwitch EndIf EndFunc Func WinGetTrans($sTitle, $sText = "") ;Author: Valik (Autoitscript.com) Local $hWnd = WinGetHandle($sTitle, $sText) If Not $hWnd Then Return -1 Local $val = DllStructCreate("int") Local $aRet = DllCall($aDll, "int", "GetLayeredWindowAttributes", "hwnd", $hWnd, "ulong_ptr", 0, "int_ptr", DllStructGetPtr($val), "ulong_ptr", 0) If @error Or Not $aRet[0] Then Return -1 Return DllStructGetData($val, 1) EndFunc Func _kill() _RestoreTrans() DllClose($aDll) Exit EndFunc Func _toogle() If $go Then $go = False TrayTip("Off - Transparency Tool v2","Press PAUSE again to start",1) Else $go = True TrayTip("On - Transparency Tool v2","Press PAUSE again to stop",1) EndIf While Not $go Sleep(100) WEnd EndFunc Func _RestoreTrans() ; Setzt die Transparenz für alle Fenster in einer For-Next schleife auf 255. ;Hiervon ausgeschlossen sind "Program Manager" (XP) und "Start" (VISTA) ConsoleWrite(@CRLF&"=========================================="&@CRLF) $WinList = WinList() For $i = 1 to $WinList[0][0] If _IsVisible($WinList[$i][1]) Then If WinGetTitle($WinList[$i][1]) = "Start" Or WinGetTitle($WinList[$i][1]) = "Program Manager" Then Sleep(10) Else ConsoleWrite("HWND: "&$WinList[$i][1] &@CRLF&"Name: "& $WinList[$i][0]&@CRLF&@CRLF) WinSetTrans($WinList[$i][1],"",255) EndIf EndIf Next ConsoleWrite(@CRLF&"=========================================="&@CRLF) EndFunc Func _IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFuncThe script changes the current active window's transparency by using CTRL+Mousewheel.Now try this out: Instead of just holding ctrl and moving the mousewheel, hold ctrl + scroll with the mousewheel and move your mouse aroundAfter a few seconds the script ends up with C:\Program Files\AutoIt3\Include\MouseSetOnEvent_UDF.au3 (201) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: If $__MouseSetOnEvent_aEvents[$i][0] = $iEvent Or $__MouseSetOnEvent_aEvents[$i][0] = $iEvent+8 Or $__MouseSetOnEvent_aEvents[$i][0] = $iEvent+16 Then If ^ ERROR C:\Program Files\AutoIt3\Include\MouseSetOnEvent_UDF.au3 (201) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: If $__MouseSetOnEvent_aEvents[$i][0] = $iEvent Or $__MouseSetOnEvent_aEvents[$i][0] = $iEvent+8 Or $__MouseSetOnEvent_aEvents[$i][0] = $iEvent+16 Then If ^ ERRORSo I dont really have the possibility to make the script public unless I want my "users" to deal with 200 Error-Messageboxes just because they moved the mouse a bit too much.So is there a workaround or something for that, or did I just make a mistake in MY script?Thats not thaaat~ bad when you're just running the script in Scite. But as soon it's compiled, it will crash like this: AutoIt Examples/UDF's:Generate Function at Runtime using IRunningObjectTable / AutoItObjectVery Simple Inter-Process Communication (using AutoItObject Pure AutoIt)
SEuBo Posted November 26, 2009 Posted November 26, 2009 Umm sorry for the doublepost but I cant edit my post anymore (!?) The last sentence* was supposed to be between the [code ] and the image. * this one: "Thats not thaaat~ bad when you're just running the script in Scite. But as soon it's compiled, it will crash like this:" AutoIt Examples/UDF's:Generate Function at Runtime using IRunningObjectTable / AutoItObjectVery Simple Inter-Process Communication (using AutoItObject Pure AutoIt)
wraithdu Posted December 1, 2009 Posted December 1, 2009 (edited) I hate to say it, but none of the normal double click events work in the low level mouse hook. Strange that I never got around to testing them before now. These are the events listed by MSDN as available: wParam [in] Specifies the identifier of the mouse message. This parameter can be one of the following messages: WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MOUSEMOVE, WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM_RBUTTONDOWN, or WM_RBUTTONUP.And inferring from the MSLLHOOKSTRUCT, these events also: If the message is WM_XBUTTONDOWN, WM_XBUTTONUP, WM_XBUTTONDBLCLK, WM_NCXBUTTONDOWN, WM_NCXBUTTONUP, or WM_NCXBUTTONDBLCLK, the high-order word specifies which X button was pressed or released, and the low-order word is reserved. Edited December 1, 2009 by wraithdu
qixx Posted December 13, 2009 Posted December 13, 2009 After a few seconds the script ends up with C:\Program Files\AutoIt3\Include\MouseSetOnEvent_UDF.au3 (201) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: If $__MouseSetOnEvent_aEvents[$i][0] = $iEvent Or $__MouseSetOnEvent_aEvents[$i][0] = $iEvent+8 Or $__MouseSetOnEvent_aEvents[$i][0] = $iEvent+16 Then If ^ ERROR C:\Program Files\AutoIt3\Include\MouseSetOnEvent_UDF.au3 (201) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: If $__MouseSetOnEvent_aEvents[$i][0] = $iEvent Or $__MouseSetOnEvent_aEvents[$i][0] = $iEvent+8 Or $__MouseSetOnEvent_aEvents[$i][0] = $iEvent+16 Then If ^ ERROR Same Problem. :/ Please Help! MfG qixx
YellowLab Posted February 5, 2010 Posted February 5, 2010 (edited) I had an issue where the mouse scroll wasn't disabled when the target window was maximized but not the top window. Instead of using this line: If $__MouseSetOnEvent_aEvents[$i][4] <> 0 And Not __MouseSetOnEvent_IsHoveredWnd($__MouseSetOnEvent_aEvents[$i][4]) Then Return 0 ;Allow default processing Where the covered maximized window still is considered to be hovered, I changed it to this to solve the problem: If $__MouseSetOnEvent_aEvents[$i][4] <> 0 And Not WinActive($__MouseSetOnEvent_aEvents[$i][4]) Then Return 0 Then you can eliminate the __MouseSetOnEvent_IsHoveredWnd function. Hope this helps! Edited February 5, 2010 by YellowLab You can't see a rainbow without first experiencing the rain.
Enforcer Posted March 10, 2010 Posted March 10, 2010 (edited) Verry good UDF, Thats REALY USEFUL THING, THX A LOT ! Found that I searched for Спасибо за УДФку, полезная штука, какраз её и не хватало чтобы закончить мою програмулинку Edited March 10, 2010 by Enforcer [RU] Zone
MrCreatoR Posted June 2, 2010 Author Posted June 2, 2010 Update... v1.8 [02.06.2010] * Fixed an issue with wrong handling when $MOUSE_XBUTTONUP/DOWN_EVENT and few other events are set. * Fixed an issue when user attempts to set other function for the event that already have been set. Now the function and other parameters are replaced for the current event. * UDF file renamed (removed "Set" in the middle and "_UDF" at the end of the name). * Cosmetic changes in the UDF code. * Docs updated. Please see the first post. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
Bot Posted June 20, 2010 Posted June 20, 2010 (edited) Thanks for the UDF. I'm about updating to position of the mouse every time the user moves it so I use the event $MOUSE_MOVE_EVENT but it always fails. Can you give me a suggestion please? #include <MouseOnEvent.au3> #include <GUIConstantsEx.au3> _MouseSetOnEvent($MOUSE_MOVE_EVENT, "MouseMove_Event") Local $hLabel, $msg GUICreate("My GUI") $hLabel = GUICtrlCreateLabel("Mouse Position", 10, 30, 100) GUISetState() Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE Func MouseMove_Event() $pos = MouseGetPos() GUICtrlSetData($hLabel, $pos[0] & "," & $pos[1]) Return True EndFunc Edited June 20, 2010 by Bot
Ascend4nt Posted June 22, 2010 Posted June 22, 2010 I'd say call it with the last parameter set to 0 (makes your function non-blocking): _MouseSetOnEvent($MOUSE_MOVE_EVENT, "MouseMove_Event","","",0,0) Also, don't try to do too much in the function - you don't want to slow down mouse movements. Oh, also, I don't know why MrCreator doesn't get the Mouse coordinates at the time the callback is made - that part makes no sense to me, because the mouse coordinates are passed and often necessary. Using MouseGetPos() is just overkill and may or may not give the right coords. You can add this to the __MouseSetOnEvent_MainHandler() function in MrCreator's UDF to get the mouse position data ($aMOUSE_CUR_POS is a global array I set): Local $stPos=DllStructCreate($tagPOINT,$lParam) $aMOUSE_CUR_POS[0]=DllStructGetData($stPos,1) $aMOUSE_CUR_POS[1]=DllStructGetData($stPos,2) What else? I can't think of anything at the moment My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
Bot Posted June 23, 2010 Posted June 23, 2010 Thanks a million. I have modified the source as you said and it now works well
ken82m Posted August 31, 2010 Posted August 31, 2010 I'm running Win7 Ultimate X64, UAC is disabled and I'm logged in as an administrator. Not sure if anyone has any ideas on this one, I'm trying to set an event for anytime I double-click on an empty spot on my desktop. In the script below the event does occurs but it happens no matter what/where I click on. Second problem is I can't get $MOUSE_PRIMARYDBLCLK_EVENT to work no matter what parameters I pass. Thanks, Kenny expandcollapse popup#include <MouseOnEvent.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <winapi.au3> #include <Constants.au3> #include <GuiListView.au3> HotKeySet("{F11}", "ExitNow") Func ExitNow() Exit EndFunc Global $h_Desktop_SysListView32 _GetDesktopHandle() MsgBox(0, "", WinGetTitle($h_Desktop_SysListView32) & @crlf & _GUICtrlListView_GetItemCount($h_Desktop_SysListView32)) _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "ToggleIcons", "", "", $h_Desktop_SysListView32) ;$hwndde = _GetDesktopHandle() ;WinGetHandle("[CLASS:NDesk;]", "") ;_MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "ToggleIcons", "", "", $hwndde) While 1 Sleep(250) WEnd Func _GetDesktopHandle() Local $aRet_Dll $h_Desktop_SysListView32 = 0 $hCBReg = DllCallbackRegister("_GetDesktopHandle_EnumChildWinProc", "hwnd", "hwnd;lparam") If $hCBReg = 0 Then Return SetError(2) $aRet_Dll = DllCall("user32.dll", "int", "EnumChildWindows", "hwnd", _WinAPI_GetDesktopWindow(), "ptr", DllCallbackGetPtr($hCBReg), "lparam", 101) $iErr = @error DllCallbackFree($hCBReg) If $iErr Then Return SetError(3,$iErr,"") Return $h_Desktop_SysListView32 EndFunc ;==>_GetDesktopHandle Func _GetDesktopHandle_EnumChildWinProc($hWnd,$lParam) if _WinAPI_GetClassName($hWnd) = "SysListView32" and _WinAPI_GetWindowLong($hWnd, $GWL_ID) = 1 then $h_Desktop_SysListView32 = $hWnd Return 1 EndFunc Func ToggleIcons() MsgBox(0,"","Go") If BITAnd(WinGetState("[CLASS:NDesk;]", ""), 2) Then WinSetState("[CLASS:NDesk;]", "", @SW_HIDE) Else WinSetState("[CLASS:NDesk;]", "", @SW_SHOW) EndIf EndFunc "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."
wraithdu Posted August 31, 2010 Posted August 31, 2010 (edited) Second problem is I can't get $MOUSE_PRIMARYDBLCLK_EVENT to work no matter what parameters I pass. Should have read my post about the subject ← Edited August 31, 2010 by wraithdu
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now