click on green pixel on screen, c# - c#

I'm getting a system Message in a SAP Software sometimes. This Software is be opened automatic from a c# wpf tool. I got this green hook at the bottom of the Message. Is it possible to find the green pixels on the screen and perform a mouse click on it when it apears?

You can't control how many green pixels where will be on-screen so while technically finding green pixels, positioning the mouse and simulating clicks is possible, you should probably not do this.
I'd suggest to look for Accessibility markers that you can use to identify these UI elements (you can do this with Accessibility Insights for example) and then use tools like AutoHotKey to automate your interaction.

Related

Get form handle from point using pinvoke ignoring calling application

I'm trying to rebuild the "Window Snip" functionality from the Microsoft "Snipping Tool"
I know how to get the boundaries of a window by first getting the window handle with p/invoke from the cursors point and after that getting the windows RECT also with a p/invoke method.
The problem I'm facing is that when I'm trying to implement an overlay like the snipping tool does I'm always getting my own applications handle.
I think the problem lies in the way I’m trying to implement that overlay. At the moment I am instancing a new form with the boundaries of the screen, Background is White with 50% opacity. I have a TransparencyKey with the color Fuchsia. My goal is that my overlay is completely transparent for the window where the mouse cursor is. (Like Snipping Tool does) For that I planning to draw a rectangle in Fuchsia with the boundaries of the underlying window to my overlay form (effectively making that spot transparent).
Is there a way to ignore my own window in the p/invoke method? Or is my idea to use a form for the overlay the wrong way to go and there is a simpler way to achieve the wanted behavior?

How do I do a "mouse click" with kinect?

I'm in the midst of developing a kinect application.
Basically, what I have now is a simple WPF form with 3 buttons, a rightHand image and a leftHand image is tracked and is working.
I have 2 problems though.
1st Problem: Unable to move "hand" pointer to the extreme right and left.
I know this has something to do with bounding box and i'm still looking for a solution online.
2nd Problem: How do I initiate a "click" without making use of Kinect Region and the Kinect Tile Buttons? I'm looking for something similar to the video shown below
https://www.youtube.com/watch?v=d_UqFf4KYJA
If this is what you are looking for ?
X-box common gestures - Open the system menu
I think you have to use timer to check if the current positon is where you want it to be and start a counter for few secs.
Maybe this can help:
Hovering button

WPF - touch gestures - suppressed mouse click if scrolling

I have multiple videos in ScrollViewer and when I click on one of these videos It plays and I got movie on fullscreen and where I moved with scroll bar It's moving with videos. This is okay. I have implemented this by adding mouse click to media element and now I am testing this on touch screen and it's working.
But I want to differentiate between click on video and moving in that area. That user don't want to "select" video but he is just moving with area but not in scroll bar but in area with videos. For better understanding I added image:
To have WPF make difference between click and move (to have both but still calling just one). What is the best way to do this? Thanks
It is very hard to handle touch events on your own, especially when you have to handle nested controls.
I think the easiest way to solve this, is for you to use the Microsoft Surface Touch Pack
Replace your ScrollView with a SurfaceScrollView and place a transparent SurfaceButton above your MediaElements and react on the Click-event (or handle it via the a command).
This way, Microsoft does the tricky panning (scrolling) or tapping (clicking) for you. And as a nice side effect, you get things like bouncing and interia of the ScrollViewer for free.

c# how to perform a screen clipping similar to OneNote Windows + S shortcut key

I'd like to implement a similar screen clipping functionality to that of OneNote. Basically it can draw a translucent overlay on top of the whole screen, and also freeze the screen so users can clip a portion of it.
I've done some research around and it seems that the easiest way is to create a translucent TopMost form with the size of the whole screen and then perform clipping on this form. This approach, however, is slow. I see some other suggestions about doing a Direct3D hook for drawing overlay, but this is probably too complicated and I'm not sure how stable it is with respect to different Direct3D version. Any ideas how OneNote does it?
I think instead of creating the transparent layer on top of the screen, just grab a screenshot of the whole screen and make it full screen. So users are drawing on a static image not a translucent layer. Since it is a screenshot already, it is already frozen. I think this is how they do it anyway, I doubt an application can simply freeze a screen, they take a photo of it and cover your screen with it, so its as if its frozen.

Windows form rotation

When you create a form in .Net it appears as a dialog box in a portrait layout.
No one normally likes to read sideways, or upside down, but I have a very valid reason to rotate the form.
Anyone knows how to do it on Windows Vista with C#?
Does it have to be in WinForms? This is very easy to do in WPF, using rotation transforms. Unfortunately, the WindowsFormsHost integration with WPF does not allow rotation transforms.
EDIT
I understand, now, that the form in question is out of the control of the poster. Writing the control in WPF won't fix the problem.
This would be a bit of extra work, but if you mainly just need the contents of the form to be rotated (and not the entire window including title bar, window controls etc., which I've never seen before), you could instead make an entirely owner-drawn usercontrol that was rotated 90 degrees, and drop it on an ordinary form. You wouldn't even have to adjust your drawing of everything, since you could do a RotateTransform on your Graphics object and then draw everything normally.
Or if you need the entire form rotated, you could make the form borderless and then do basically the same thing, drawing the title bar and windows controls yourself also.
Update: here's a link to an MSDN article that shows how to rotate the entire screen in C#:
http://msdn.microsoft.com/en-us/library/ms812499.aspx
This is for regular Windows (not Windows Mobile), so it should work for your porpoises, although it will rotate all of Windows and not just your application's form. Depending on how fast this works and your overall needs, you could rotate the screen 90 degrees when your application gets the focus, and then rotate it back to normal when your app loses focus.
Update 2: I just reread your question and comments. You're talking about rotating the window of a separate application in a separate process, so WPF will definitely not help you here. The MSDN link might be what you need. In your application, you would rotate the screen 90 degrees, then start the other application in a separate process. This would work best if you could force the separate application's window to be maximized, which you can do by P/Invoking the FindWindow and SendMessage APIs (you could also make the window always on top, which would put your computer into a sort of kiosk mode for this application). There's a version of the Process code that basically makes starting another application a blocking call, which means your app will wait for the shelled application to close before resuming. Once the app closes, you can put the screen back to its normal orientation.

Categories