Jump to content
Sign in to follow this  
goldenix

_WinAPI_Mouse_Event Q

Recommended Posts

goldenix

see, it does not work. & there are no examples in the help file. how can I find out if the mouse wheel has been moved?

#Include <WinAPI.au3>
;~ #Include <Constants.au3>

Opt("WinTitleMatchMode", 2)    

Global $win = ' - Mozilla Firefox'


While 1
    Sleep (500)

    $test = _WinAPI_Mouse_Event($MOUSEEVENTF_WHEEL)
    
    If WinActive($win) And $test <> '0' Then _set_firefox_focus() ; if firefox active & mouse wheel was moved
        
    ConsoleWrite($test & ' ')
WEnd



Func _set_firefox_focus()
    ControlFocus("[CLASS:MozillaUIWindowClass]", "", "MozillaWindowClass5")
    $controlclick = ControlClick("[CLASS:MozillaUIWindowClass]", "", "MozillaWindowClass5",'left',2,1,1)
EndFunc

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

Share this post


Link to post
Share on other sites
trancexx

see, it does not work. & there are no examples in the help file. how can I find out if the mouse wheel has been moved?

#Include <WinAPI.au3>
;~ #Include <Constants.au3>

Opt("WinTitleMatchMode", 2)    

Global $win = ' - Mozilla Firefox'


While 1
    Sleep (500)

    $test = _WinAPI_Mouse_Event($MOUSEEVENTF_WHEEL)
    
    If WinActive($win) And $test <> '0' Then _set_firefox_focus() ; if firefox active & mouse wheel was moved
        
    ConsoleWrite($test & ' ')
WEnd



Func _set_firefox_focus()
    ControlFocus("[CLASS:MozillaUIWindowClass]", "", "MozillaWindowClass5")
    $controlclick = ControlClick("[CLASS:MozillaUIWindowClass]", "", "MozillaWindowClass5",'left',2,1,1)
EndFunc
No, _WinAPI_Mouse_Event() works just fine.

You are using it wrong.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
MrCreatoR

Ho sais that this is for set an event, it's for triggering the event ^_^

Look at «_MouseSetOnEvent UDF» in my signature.


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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
 
AutoIt_Icon_small.pngExamples: 
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 AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
goldenix

Ho sais that this is for set an event, it's for triggering the event ^_^

Look at «_MouseSetOnEvent UDF» in my signature.

I tried your UDF & do not understand how to use it. I looked at the examples & they are too messy to understand anything. This wahy I tried to use _WinAPI_Mouse_Event, but since there are no examples, I have no idea how to use it. someone explain please.

maybe my example was too complicated? I just want to know if my mouse wheel was moved up or down.

If moved, return 1 else return 0

HireI shortened my example:

#Include <WinAPI.au3>

While 1
    Sleep (500)

    $test = _WinAPI_Mouse_Event($MOUSEEVENTF_WHEEL) ; if mouse wheel was moved

    ConsoleWrite($test & ' ')
WEnd
Edited by goldenix

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

Share this post


Link to post
Share on other sites
MrCreatoR

I looked at the examples & they are too messy to understand anything

Really?

#include <MouseSetOnEvent_UDF.au3>

HotKeySet("^q", "_Quit")

Global $iMouse_Wheel = 0

_MouseSetOnEvent($MOUSE_WHELLSCROLL_EVENT, "MouseWheelScroll_Event", "", "", 0, 0) ;Last 0 = Not block, just call the function

While 1
    Sleep(100)
    
    If $iMouse_Wheel = 1 Then
        ConsoleWrite("Mouse Wheel Event recieved." & @CRLF)
        $iMouse_Wheel = 0
    EndIf
WEnd

Func MouseWheelScroll_Event()
    $iMouse_Wheel = 1
EndFunc

Func _Quit()
    _MouseSetOnEvent($MOUSE_WHELLSCROLL_EVENT) ;UnSet the event
    
    Exit
EndFuncoÝ÷ Ú«¨µäáÌ"-®'¶¬yµ¢È2¬xKÞßÛnëlw¶«yªÞ±jjezÂ!j÷§¢'^j0¶¬z+ªê-y.ë-v÷öÙÞyØ­Ýý²z-~í«iººh±æÏKöÀÊ%¢¶êå

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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
 
AutoIt_Icon_small.pngExamples: 
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 AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
goldenix

Really?

Ok its very hard to understand what is going on in those examples. Its faster to just search for another wheel UDF. I did & found this nice & easy to use one.

But lets say I have a loop that will always activate when I move the mouse wheel :

While 1
    if mousewheel_was_moved_down then _do_something()
WEnd

Func _do_something()
    MouseWheel("down", 3)
EndFunc

In this case It will be stuck in an infinite loop. How to determine who is sending MouseWheel(down)? then I can only activate it if real mouse wheel was moved.

EIDT: No switches wont work hire

Edited by goldenix

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

Share this post


Link to post
Share on other sites
MrCreatoR

its very hard to understand what is going on in those examples

Hm, it's just me or what? ^_^ I don't see anything hard there.. well, it's how you see it, it's ok. Then please tell me how it will be more understandable.

It's a joke, right? ;) - It's faaar more dificult to use then what i gave you in my last post.

In this case It will be stuck in an infinite loop

Right, but if you unset the event before MouseWheel and set after it, your problem will be solved :(

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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
 
AutoIt_Icon_small.pngExamples: 
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 AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.