Simulating mouse down/click on multiple windows (4 windows) - c#

We have 4 3rd party applications that run on the same machine.
There are a few buttons that we need to manually click every single time on all 4 windows.
The windows are all the same size and never change positions.
How could we simulate a Mouse Click / Mouse Down on these windows? We can't use SetCursorPos/mouse_event since we want to "Simulate" a click and mouse drag in real time. A user's mouse cursor can't be moved, it has to emulate a click.
I can use Spy++ to get the necessary window handle/class, but I would like to know what needs to be sent to the window to make it work.

Related

C# Prevent mouse over effects in other applications

I'm writing a screen shot app where I need to prevent the mouse over effect in all windows. For example, when hovering over a button or hyperlink they will often change color as a form of feedback. My goal is to take a screen shot where the user clicks without the additional feedback.
I can see two approaches:
Disable / ignore the system cursor and create my own. Allow it to fly around the screen without triggering any hover effects. Send a mouse_event when the user clicks using winuser.h
Use a semi-transparent topmost WPF window that allows clicks pass through to other windows. THis answer feels close, but does trigger hover over effects in other windows.
Option 1 is feasible, but I would need to also account for right clicking and scroll wheel.
Option 2 would be best if I could pass through the click event and not the mouse movement. Is this possible in WPF or should I roll my own cursor controls?
Thanks!

Create a WPF Window that captures AND passes through Mouse Events

I'm working on a screen capture utility that captures active windows. I'm using transparent overlays to capture the full screen and then overlay the active windows based on mouse move events passed through to the underlying desktop/windows.
Both of the overlay windows currently use the WS_EX_TRANSPARENT style to allow mouse events to pass through to the underlying windows so I can detect where the mouse cursor is located. I grab the window handle and rect size to outline the window and then use Global Mouse and Keyboard Hooks to accept or reject a capture.
It's pretty ugly and spread out code (which is why I'm not posting here for now) but it all works very well and I can highlight the windows in mousemove and capture clicks with the global mouse and key handlers.
It all works except for this problem:
The Global Windows Hooks do not fire over an Admin Window so when I want to capture a Powershell, Command or Visual Studio (in Admin mode) Window no hook events are forwarded.
Apparently there's no way to work around this security issues using Windows hooks (or GetAsyncKeystate() for that matter).
I've tried a couple of different approaches to work around this issue:
Instead of using Hooks I tried using the highlight window to capture mouse/key events
This sort of works, but it's clumsy - fails if no window is selected at all (no way to get out) and doesn't allow for selecting contained windows once the parent is selected (ie. no drill down)
I also tried Win32 GetAsyncKeystate() which captures the last mouse or keyboard input and that would work, but it too fails to send mouse or key interactions from Admin windows.
So I have two choices imperfect solutions at the moment: using Hooks or GetAsyncKeyState to get the proper Window browsing selection behavior for all but admin windows, or I can capture all windows but lose the ability to drill into child windows after a parent window is selected.
I'm at the end of my rope and the real question is this:
Is there some way to create a semi-transparent or transparent window that can intercept mouseclicks and pass them on to the window area below?

Windows 8.1 Store App: Hide mouse cursor and peridocialy move to screen-center

Is it possible to hide the mouse cursor in a Windows 8.1 Store App and move the mouse back to the screen center while moving?
something like this (SDL code):
SDL_ShowCursor(false);
...
SDL_WarpMouse(screen.width/2,screen.height/2);
Moving mouse pointer automatically to center is not possible in Windows app. It is avoid fooling/cheating (not the right word, but still close enough) users in app. For example, if a developer is allowed to do so then just before the click of the mouse button developer can always hide the mouse pointer from that place and move it to desired position and get ads clicked, even though user didn't wanted to do so!
This also goes well with Windows 8/8.1 app design principles, that apps can use limited resources of the system.

How to move my form when on screen keyboard is shown

Im trying some different alternatives for onscreen keyboard for our desktop application that is being run on a windows 8 tablet without keyboard.
So far Tabtip.exe have been working best but im open to other solutions.
The problem i have is when the user clicks on a textbox in the application and i show the onscreen keyboard, the keyboard hides the textbox.
How do fix this in a good way?
Is it something that windows can handle automatically? Some applications like outlook and word gets a "splitscreen" with a scroll bar in the upper part where the applications is and the keyboard in the lower part. I want a solution like that to. How do they do it?
One solution could be to always move my window up a set amount of pixels that is the same as the keyboard height. But i don't want to move the application if the keyboard doesn't cover the textbox.
But how do i determine how high the keyboard is? is it always the same height? How do i detect where the window is?
Any other solutions?

Disable click on a 3rd party application

I'm writing an application that needs to record a click location on the screen, over the top of another window using the mouse. Is there anyway to disable the mouse click so that it doesn't affect the window that is being clicked over?
e.g. I want to set a point over the top of my browser, but I don't want to click anything within my browswer whilst setting it.
You have a couple options:
Write a plugin/extension for the browser you're talking about. Maybe the browser's interface allows you to record such information
Use windows hooks. Using SetWindowsHookEx and WH_MOUSE_LL, you can get all mouse activity on the computer fairly simply. You will just need to check if the mouse activity is happening in the browser, using WindowFromPoint.

Categories

Resources