mouse

How to move mouse with c++

耗尽温柔 提交于 2019-12-03 08:25:07
I want to move the mouse cursor with a c++ script. I am using Visual C++ 2010 Express in a Windows 7 inside Parallels and I created a console application. I know SetCursorPos method but it is just not working (it does nothing). I managed to simulate clicks with SendInput but it does not actually move the mouse. This is my code: #include <Windows.h> #include <Tlhelp32.h> #include <stdio.h> #include <string> #include <iostream> #include <fstream> #include <sstream> #include <time.h> void mouseLeftClick(const int x, const int y); // window HWND hWindow; int main() { // find window hWindow =

Command-click doesn't open a new tab, but middle-click does

喜夏-厌秋 提交于 2019-12-03 08:22:08
问题 On my website, which is a one-page JS site using Sammy.js and jQuery, when I middle-click a link with a mouse, the link opens in a new tab. But when I command-click on a Mac, it doesn't. This happens in both Firefox and Chrome, so I assume it must be according to spec in some way. This happens on a Macbook Air (so trackpad + command button). Most sites work just fine though, with command-click being identical to normal middle-click. Try it out yourself: https://circleci.com. Command-click

Difference between Mouse Listener and Action Listener?

余生颓废 提交于 2019-12-03 08:06:09
Whats the difference? When would you use a mouse listener? or a action listener? Please and Thank You! ActionListener Doc's The listener interface for receiving action events. The class that is interested in processing an action event implements this interface, and the object created with that class is registered with a component, using the component's addActionListener method. When the action event occurs, that object's actionPerformed method is invoked. MouseListener Doc's The listener interface for receiving "interesting" mouse events (press, release, click, enter, and exit) on a component.

Distinguishing a single click from a double click in Cocoa on the Mac

耗尽温柔 提交于 2019-12-03 07:58:49
问题 I have a custom NSView (it's one of many and they all live inside an NSCollectionView — I don't think that's relevant, but who knows). When I click the view, I want it to change its selection state (and redraw itself accordingly); when I double-click the view, I want it to pop up a larger preview window for the object that was just double-clicked. My first looked like this: - (void)mouseUp: (NSEvent *)theEvent { if ([theEvent clickCount] == 1) [model setIsSelected: ![model isSelected]]; else

scroll window when mouse moves

北城余情 提交于 2019-12-03 07:32:32
Hello all What I mean is while the mouse is moving towards the edge of the window (x or y or both), I want the page to scroll, and when the mouse stops moving, I want the page to stop scrolling. There are numerous examples of how to scroll based on using a onClick event or a scroll zone at the edge of a window, but not much based on the movement of the mouse cursor. Any help would be much appreciated. Web pages are already designed to scroll using the scroll bar, page/home/end/arrow keys, etc. Is there any reason that's insufficient for your page? It's usually not a good idea to alter expected

How to Compile: Synergy on mac

家住魔仙堡 提交于 2019-12-03 07:30:53
问题 I wanna use Synergy on my MAC and Windows. download synergy.zip file from https://github.com/synergy/synergy and then I try to compile to Xcode Project But I get the following error message bash-3.2# ./hm.sh conf -g2 Mapping command: conf -> configure Error: Arg missing: --mac-identity I don't know why I cannot compile Synergy. Questions. What is --mac-identity ? How to typing command to terminal on my MAC? 回答1: I was able to get this working on Yosemite with the following command: ./hm.sh

Ignore mouse and keyboard events in Qt

﹥>﹥吖頭↗ 提交于 2019-12-03 07:19:54
In Qt, how can I ignore all mouse and keyboard events and later stop ignoring them? That is: click a button, ignore all events in children; click again, not ignore. Is that clear? I have the following lines, but maybe I'm doing something wrong: setAttribute(Qt::WA_TransparentForMouseEvents); setFocusPolicy(Qt::NoFocus); Dont use setFocusPolicy(Qt::NoFocus); and it will propagate events to the parent. Use only setAttribute(Qt::WA_TransparentForMouseEvents); You can use Events' filters on your mouse and keyboard events to filter some keypress or mouseclick when you need so : yourWidget-

How can I make a Windows 8 Metro scrollviewer respond to mousewheel?

久未见 提交于 2019-12-03 07:13:45
I'm currently writing an app for Windows 8 using Metro and C#. In my app I use a combination of scrollviewer and gridview to show my data. My problem is however, how can I make it scrollable with a mouse wheel? In my searching I found MouseWheelParameters located in System.Windows.Input, but when I try to use the get_pageTranslation, it gives an error stating I can't explicitly use the get method. The "get_pageTranslation" is actually the " PageTranslation " property on the MouseWheelParameters, you access it by saying: wheelParameters.PageTranslation this: get_PageTranslation() is the name of

Java Robot class simulating human mouse movement

孤街醉人 提交于 2019-12-03 06:28:42
I am working on a project about remote control, send conrdinate x and y of cursor from client to server. But robot.mouseMove(x,y); will only move the cursor to the particular point without moving the cursor form origional point I have find this simple algorthim to simulate the continuing movement of mouse for (int i=0; i<100; i++){ int x = ((end_x * i)/100) + (start_x*(100-i)/100); int y = ((end_y * i)/100) + (start_y*(100-i)/100); robot.mouseMove(x,y); } But this algorthim still too simple, it just move from one point to other point slowly, which still unlike human behave. I have read some

Mouse Hover on WebElement using Selenium 2 in Java [duplicate]

a 夏天 提交于 2019-12-03 05:52:43
This question already has answers here : Is there a proved mouseOver workaround for FirefoxDriver in Selenium2? (3 answers) Possible Duplicate: Is there a proved mouseOver workaround for FirefoxDriver in Selenium2? I want to be able to mouse hover a WebElement with the Java Selenium2 API. Is that possible? I am using the current beta 3. This will help you: WebElement elems=driver.findElement(By.linkText("Custom Development"));//Menu Item WebElement elems1=driver.findElement(By.xpath("//li[@id='item-465']/a"));//Menu Actions builder = new Actions(driver); Actions hoverOverRegistrar = builder