mouse

Windows: send Mouse/Keyboard event to background window?

别等时光非礼了梦想. 提交于 2019-12-06 12:17:47
问题 My application is a fullscreen window which is rendering a designated other window (from dwm), for example Google Chrome. I would like to know if it's possible to send events (such as mouse keyboard events) to the specified window. Of course the designated window has to stay in background, and my current application on the foreground. My application is written in C++. I'm working on Windows 7/8. 回答1: Just to put it into an answer. Based on this question Does any program/language/library that

Grab exclusively/release mouse in application (Windows, C++)

核能气质少年 提交于 2019-12-06 11:46:09
I have lost many hours trying to grab exclusively the mouse in my application and re-releasing it. Right now, I am grabbing it correctly: the mouse cursor disappears from screen and I can read its properties fine. However, I can't release it correctly! The mouse cursor reappears on screen but no other application is receiving any mouse clicks any more; except mine. Here is the problematic code : IDirectInputDevice8* mMouse; void Win32Mouse::grab(bool grab) { if (mGrabMouse == grab) return; mMouse->Unacquire(); if (grab) { // grab = true; seems to work fine coopSetting &= ~DISCL_BACKGROUND;

Move Mouse - VBScript and Excel Macro

对着背影说爱祢 提交于 2019-12-06 11:25:23
Found a script that uses Excel to move the mouse in VBScript. This is almost exactly what I am looking for for my project, however I need to alter a small bit to enable me to enter coordinates in the code for it to move the mouse specifically to those coordinates; the code currently uses the current mouse position and moves from that position - I need to be able to have the mouse move to an ABSOLUTE position, not a RELATIVE one. Here's the VBS code: Option Explicit Dim Excel, GetMessagePos, x, y, Count, Position Set Excel = WScript.CreateObject("Excel.Application") GetMessagePos = Excel

Moving mouse to stop monitor from sleeping [duplicate]

回眸只為那壹抹淺笑 提交于 2019-12-06 11:16:56
This question already has answers here : How to prevent Windows from entering idle state? (5 answers) Closed 5 years ago . I want to stop my monitor to stop sleep (which is driven by company policies). Below is the code I am using for that while (true) { this.Cursor = new Cursor(Cursor.Current.Handle); Cursor.Position = new Point(Cursor.Position.X - 50, Cursor.Position.Y - 50); Cursor.Clip = new Rectangle(this.Location, this.Size); System.Threading.Thread.Sleep(2000); this.Cursor = new Cursor(Cursor.Current.Handle); Cursor.Position = new Point(Cursor.Position.X + 50, Cursor.Position.Y + 50);

Cocoa - Capturing NSStatusItem mouse hover event

扶醉桌前 提交于 2019-12-06 10:24:39
How do I execute a function when a user's mouse hovers over my NSStatusItem? If you assign a custom NSView to your NSStatusItem 's view property, you can override the NSResponder methods mouseEntered: , mouseMoved: and mouseExited: . 来源: https://stackoverflow.com/questions/5114974/cocoa-capturing-nsstatusitem-mouse-hover-event

Detecting Horizontal Mouse Wheel movement

末鹿安然 提交于 2019-12-06 10:20:08
问题 I am using the mousewheel in my DotNet application, which I have done by following: MSDN MouseWheel example But on my application it would be great to also use the existing hardware horizontal mouse wheel too. But how can I detect when this is used in .Net? I am using Logitech RX1500 or or m-RAG97. Regards - * Solution * Override the WinProc to catch the mouse wheel event. MustInherit Class Win32Messages Public Const WM_MOUSEHWHEEL As Integer = &H20e 'discovered via Spy++ End Class Protected

capturing right-click+left-click with autohotkey; unexpected behaviour

我的未来我决定 提交于 2019-12-06 08:27:15
问题 This question was migrated from Super User because it can be answered on Stack Overflow. Migrated 7 years ago . I want to capture the key event "right mouse button pressed, then left mouse button pressed". No problem in autohotkey. However I am having trouble with still allowing the right-mouse key to work alone. 1) this works: RButton & LButton:: Send X Return works as expected: If I press right mouse button, then left mouse button, "X" is sent to the active window right-click event is

Trying to change Windows mouse cursor icon from java through jni call

给你一囗甜甜゛ 提交于 2019-12-06 07:58:30
In my java application, i m trying to change the mouse cursor with an argb 32bit bmp file with transparency. I want to make a jni call to change it from Windows because changing the cursor in java gives me a really bad mouse cursor (all the transparency is either 0x00 or 0xFF) At the moment i'm trying to use the function SetClassLong with as parameters: the hWnd from java (i got it following that method http://download.oracle.com/javase/1.3/docs/guide/awt/AWT_Native_Interface.html ) GCL_HCURSOR and a cursor made from a raw argb 32bit bmp buffer That piece of code works in a sample win32 atl

Algorithm to recognise mouse movements

空扰寡人 提交于 2019-12-06 07:56:48
问题 Am wondering if there has been any research/algorthms which specify the amount of deviation of the mouse while recognizing characters like say "?" drawn using the mouse. Something a sort of optical character recognition, but probably a simpler version. Is there some algorithm using which I can say that a question mark drawn by the user is really a question mark and not something else with some amount of accuracy ofcourse. Something like what windows tablet software allows (while writing with

Is it possible to put the mouse cursor behind an element or does the mouse cursor have an z-index?

最后都变了- 提交于 2019-12-06 07:49:34
问题 I would like to replace the mouse cursor with an custom image when the mouse hovers over a certain element. I do it by setting the mouse curser off first with cursor: none; when it hovers the element. Then I read out the cursor position on the hovered element and set the css position of a graphic to the cursor position with a slight offset, so that the mouse curser is not over the graphic but still over the hover area. I made a fiddle here: http://jsfiddle.net/TimG/6XeWK/ Now it works quiet