Mouse Button 4 Key Code

0 views
Skip to first unread message

Quinton Hebenstreit

unread,
Aug 3, 2024, 5:52:38 PM8/3/24
to tighdiforse

Requires Windows Vista or later. These can be used as hotkeys with some (but not all) mice which have a second wheel or support tilting the wheel to either side. In some cases, software bundled with the mouse must instead be used to control this feature. Regardless of the particular mouse, Send and Click can be used to scroll horizontally in programs which support it.

Although any single character can be used as a key name, its meaning (scan code or virtual keycode) depends on the current keyboard layout. Additionally, some special characters may need to be escaped or enclosed in braces, depending on the context. [v1.1.27+]: The letters a-z or A-Z can be used to refer to the corresponding virtual keycodes (usually vk41-vk5A) even if they are not included in the current keyboard layout.

Due to system behavior, the following keys separated by a slash are identified differently depending on whether NumLock is ON or OFF. If NumLock is OFF but Shift is pressed, the system temporarily releases Shift and acts as though NumLock is ON.

Specify for nn the hexadecimal virtual key code of a key. This rarely-used method also prevents certain types of hotkeys from requiring the keyboard hook. For example, the following hotkey does not use the keyboard hook, but as a side-effect it is triggered by pressing either Home or NumpadHome:

Joy1 through Joy32: The buttons of the controller. To help determine the button numbers for your controller, use this test script. Note that hotkey prefix symbols such as ^ (control) and + (shift) are not supported (though GetKeyState can be used as a substitute). Also note that the pressing of controller buttons always "passes through" to the active window if that window is designed to detect the pressing of controller buttons.

Multiple controllers: If the computer has more than one controller and you want to use one beyond the first, include the controller number (max 16) in front of the control name. For example, 2joy1 is the second controller's first button.

Reconfigure the software that came with your mouse or keyboard (sometimes accessible in the Control Panel or Start Menu) to have the "mystery key" send some other keystroke. Such a keystroke can then be defined as a hotkey in a script. For example, if you configure a mystery key to send Ctrl+F1, you can then indirectly make that key as a hotkey by using ^F1:: in a script.

The following is a last resort and generally should be attempted only in desperation. This is because the chance of success is low and it may cause unwanted side-effects that are difficult to undo:
Disable or remove any extra software that came with your keyboard or mouse or change its driver to a more standard one such as the one built into the OS. This assumes there is such a driver for your particular keyboard or mouse and that you can live without the features provided by its custom driver and software.

Some configurations of Windows IME (such as Japanese input with English keyboard) use CapsLock to toggle between modes. In such cases, CapsLock is suppressed by the IME and cannot be detected by AutoHotkey. However, the Alt+CapsLock, Ctrl+CapsLock and Shift+CapsLock shortcuts can be disabled with a workaround. Specifically, send a key-up to modify the state of the IME, but prevent any other effects by signalling the keyboard hook to suppress the event. The following function can be used for this purpose:

So I am just getting myself into coding using C++ and after learning a bit I started coding an auto clicker. I have already made it so you can toggle the auto clicker using a button on your keyboard or something of that sort, but that isn't what I'm looking for.

I can get it working by checking the key state of VK_LBUTTON, but that only checks to see if the left mouse button has been pressed, not held. So it just continuously clicks until you break the while loop or close the program.

Not really worth putting this down but my 12 am self, thought that checking if the left button had been pressed (like the one before), it would set a boolean value to true and then keep on clicking. But after that, I couldn't get it to stop like before. Now looking back at the code, I understand why it wasn't working.

Like I said before, I have tried all different combinations to try and get this to work. But I can't see if the left mouse button is held down. I hope someone has the answer and can help me out and other people out. Anyways, thanks and have a nice day.

Also, GetKeyState() relies on a state machine that is local to the calling thread. That state machine is updated only when the thread processes keyboard/mouse window messages from its message queue. Your code has no such message processing. For what you are attempting, use GetAsyncKeyState() instead.

I'm not sure whether I understood the q correctly .. but for checking the pressed state you have always to check the lowest bit in the returned high-byte of GetKeyState(VK_LBUTTON) (see GetKeyState() in MSDN-- means:

This property only guarantees to indicate which buttons are pressed during events caused by pressing or releasing one or multiple buttons. As such, it is not reliable for events such as mouseenter, mouseleave, mouseover, mouseout, or mousemove.

As noted above, buttons may be configured differently to the standard "left to right" layout. A mouse configured for left-handed use may have the button actions reversed. Some pointing devices only have one button and use keyboard or other input mechanisms to indicate main, secondary, auxiliary, etc. Others may have many buttons mapped to different functions and button values.

\n This property only guarantees to indicate which buttons are pressed during events caused by pressing or releasing one or multiple buttons.\n As such, it is not reliable for events such as mouseenter, mouseleave, mouseover, mouseout, or mousemove.\n

\n As noted above, buttons may be configured differently to the standard \"left to right\" layout.\n A mouse configured for left-handed use may have the button actions reversed.\n Some pointing devices only have one button and use keyboard or other input mechanisms to indicate main, secondary, auxiliary, etc.\n Others may have many buttons mapped to different functions and button values.\n

But can you list some examples of productivity apps which do this? Games are their own self-contained design-world. Apps - and especially cross-platform apps - usually have to be more generic and respect the rules of OS conventions, as far as I can imagine as a non-designer.

Navigate back and Navigate forward are apparently already bound to Mouse 4/5 (which seems to have been an issue), the same way its done in browsers and IDEs I know, but this is not noted in the hotkey settings and trying to bind anything to these keys just navigates notes in the background.

Allow mouse events + modifier key shortcuts to be specified in the hotkeys settings page, in the same way that keyboard only key combinations can be specified there. Include the current behaviour as the default shortcuts.

IDEs/Code editors tend to allow you to customise mouse click actions. E.g Configure keyboard shortcuts IntelliJ IDEA. I only have a three button mouse to test with, but it collects the setting by the user performing the desired mouse + modifier key press inside a dialog box, and can detect left/right/middle that I have. Up to five mouse buttons are supported cross-platform in browser mouse events MouseEvent.button - Web APIs MDN

There is must exist some functionality in Obsidian mapping mouse events to actions. This feature would make that mapping customisable + expandable through the existing hotkeys interface. It seems feasible in general that looking up a mouse event handler could work in the same way the existing keypress event handler does for hotkeys to work. As long as the default settings match the OS conventions, if a user deliberately changes the behaviour to break convention then that is their choice.

Call Mouse.GetState() to get the state of either one. The OS will support all five and can recieve an input from all 5, but not all mice send data from all the buttons and provide just the basic 2 button setup.
it would be best to expect a 2 button mouse then allow the user to configure the other buttons if they are available.

I'm trying to detect if mouse button is pressed. For now I have managed detecting mouse button status using Event Structure but my code inside loop is paused then. I would like to perform code inside while loop and to have one boolen indicator saying if mouse button is pressed or not. Code inside While loop must run all the time.

Thanks, but I'm not sure what have you try to show me with your code. I have very large project running inside while loop. I must be able to know if left mouse button is currently pressed or not. If you press left mouse button while hovering over plot or indicator, you will see LED turning ON signaling pressed mouse button. My code inside while loop must run constantly regardles of mouse button status. I'll use information about mouse button state to disable only one small part of code inside my project.

i am working on a project to use optical mouse as a distanced logging device that is i record the mouse position as the mouse moves along a path then I make a relation between the mouse couser position in pixel with length moved by body of the mouse in mm.

Every thing is OK when I use the mouse in short ranges ( 30- 40 mm) and the crusor is in the range of the monitor but when I wana move it in about 1 meter or more which is out of the range of the monitor screen problem began

at the top of the monitor the position is fixed and it do not change anymore. For recording pixels greater than the vertical limit of the monitor I try to set the mouse position to a fix number to get the changes of the mouse position by set_crusor_pos.vi .

So I want to save the absolute changes of the mouse position even out of the range of the monitor e.i. if the mouse crouser is at the top of the monitor and if i move it upper I should record a movement in the up side direction.

c80f0f1006
Reply all
Reply to author
Forward
0 new messages