first of all pleas excuse my rather bad English spelling. Well I am searching for a way to emulate a scrollwheel rotation. I need to scroll much more sensitive than the scrollwheel on the mouse does. Unfortunately I can not simply use keyboard emulation of up/down arrows. I've been programming vb.net for some years (hobby) and got to know some nice code in .NET which realises "all my dreams". It makes use of user32.
1 2 3 4 5 6 7 8 9
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Integer) As Short
Private Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cbuttons As Integer, ByVal dwExtraInfo As Integer)
Private Const MOUSEEVENT_WHEEL = &H800 'die entscheidende constante [dwFlag]
Dim SCROLLUP As Integer = 120 'Scrollgeschwindigkeit hoch
Dim SCROLLDOWN As Integer = -120 'Scrollgeschwindigkeit runter
'call:
'mouse_event(MOUSEEVENT_WHEEL, 0, 0, SCROLLDOWN, 0)
Unfortunately I am quiet new to Cpp but I have been doing a few basic things with C. But I never came to include more than math.h, stdio.h an so on. So can somebody help me to realise this in C++? The first thing I'm rather sure about is, that I need to include windows.h but that's where my knowlede gets to an end.
Following Errors occure at the line containing: mouse_event(MOUSEEVENT_WHEEL, 0, 0, SCROLLDOWN, 0);
- Invalid Arguments ' Candidates are: void mouse_event(unsigned long int,unsigned long int,unsigned long int,unsigned long int,unsigned long int) '
- Symbol 'MOUSEEVENT_WHEEL' could not be resolved
In fact I do miss the Private Const MOUSEEVENT_WHEEL = &H800
but I don't know how to realise that =)
Okay I think I need to do this more in detail. But I think I know what this function does - from MSDN: "The mouse_event function synthesizes mouse motion and button clicks". That is exactly what I want to do. I just don't know how to include correctly and how to "call" the function correctly. In my eyes the mous_event() is not resolved. So that's why I get the MOUSEEVENTF_WHEEL not resolved correctly. Is that right? Or did I do a huge mistake using the mous_event() in the main function? I just don't get what I missed ... thx