In my console application, SendKeys.SendWait("^c") is called to copy some selected text to the clipboard.
It works fine, but if my console application has focus when this is called, then, instead of throwing an exception, it just closes my application. And then after that things start acting up, like my mouse wheel affecting the zoom instead of scrolling up and down.
Why dose this happen.
ctrl+cis the signal for a Console window to close.
And the reason the mouse wheel is affecting zoom after it closes is because the application never got a chance to release the ctrl key.
This can be fixed by changing the ConsoleMode or changeing the Console.TreatControlCAsInput Property.
Thanks for the help
Related
I've recently been trying to develop a small GUI application for my raspberry using avalonia ui. The application should run in full-screen mode and hide the cursor when it is running in full screen. For that I've set up a timer that starts as soon as the mouse stops moving.
Running the application in Windows, everything works as expected. Three seconds after the mouse stops moving, it hides itself.
On the raspberry the application starts in full screen, but the cursor doesn't hide, it just flickers. At least as long as the mouse wasn't moved since starting the application. By manually moving the mouse after the application started everything works fine again.
The main issue I'm facing is, that the app starts itself when the raspberry has started up and it's unpractical to have someone that needs to move the mouse in order for the cursor to hide.
Does anyone have a possible solution?
So after a bit trial and error I've managed to create a simple workaround on how to fix it.
By installing the xdotool package for on the rapsberry you can move the mose from commandline.
With this I've set up a script that starts the program and after a delay of 5 seconds moves the mouse.
I've also recently been working on a small GUI application for my RaspberryPI using AvaloniaUI, running in a very similar manner.
I observed the same effect when setting the Cursor to None. This seems like a bug.
My work-around was to install an OS level solution, unclutter.
sudo apt-get install unclutter
Unclutter hides the cursor after approximately 1 second of inactivity by default, which will work for my project, if this does not work for you there are ways to set the idle time. You can experiment with timing by using…
#unclutter -idle 3
Check their documentation for setting the idle time permanently.
We have a WPF app which runs fine, but a user reported that it locks up when the screen is rotated. (Tablets will do that!)
The app actually renders fully after the rotate but stops responding to the mouse/keyboard. It doesn't show as 'non-responding' in a Windows sense.
We can simulate the "lock up" here, but debugging this is odd:
Lock up does not occur while in VS debugger
If you try and attach to the locked up process, VS says the process was built without debug information
Before the lockup VS can attach/deattach to the same EXE process
We have put trace outputs in global unhandled exceptions but nothing is fired.
I can only think of one next step to debug which is start to hack out chunks of code and find the breaking area.
Anyone seen this before or got any suggestions?
Thanks!
The issue was with an update library we were using called Sparkle.
It was creating a hidden WinForms form in it's constructor. There must be some kind of WPF/WinForms interop bug during screen rotations. Removing that form or removing the library fixed the issue.
[Mouse cursor over window]: When I type in textboxes, on a .NET C# 4.0 window, the mouse cursor disappears and this is strange by itself.
[Mouse cursor outside window]: When I type in textboxes and press ENTER key to do some stuff in the UI thread, and then while doing that stuff, I move the mouse cursor over the window, the mouse disappears.
What can I do to keep the mouse always visible?
When typing in a text box (in any application) Windows will automatically hide your cursor. Some UI person will probably say that it's to prevent distractions, this is just my guess. If you move your mouse again, it will reappear.
The reason that your cursor is staying invisible while doing work in the UI thread is just that: Your application is busy doing work on the UI thread. Because your operation is happening there Windows is not able to redraw the area of the screen where your application is. That's why the mouse "disappears" again.
The two issues while manifesting similarly are different.
If you know that you need to do a lot of work, but it doesn't interact with the User Interface at all, you should kick off that work in a separate thread, so that your application continues to feel responsive to your user.
If you eventually need to do cause something to happen to the UI from another thread, you'll need to check out the Control.Invoke method.
How can you tell when a windows 8 Metro app gets put in the background? The suspended state doesn't activate. I have a break point on. It only hits if I close the app.
I am using a webcam and since no apps can run in the background I need to save my work when it's put in the background.
The windows phone it was application deactivated.
any help would be nice.
Apps do not normally get suspended when in the debugger. However, you can force a suspend when debugging by:
Enabling the Debug Location toolbar (red arrow in image below).
Then press the Suspend button (blue arrow).
The suspending event should fire when the application is no longer active, namely, when another application is brought to the front. Presuming you're using C#/XAML, the app.xaml.cs file already has the Suspending event wired up. In HTML5/JavaScript it's checkpoint and you'll see it in default.js.
In an application that I am currently working on, a requirement is to bring a window of an external application to the foreground. Making Win32 API calls such as BringWindowToTop and SetForeground window do not work all the time. This is due to some restrictions within Windows XP. What I would like to do instead is send simulate a mouse click the window's button on the taskbar which I am hoping will bring the window to the front. Does anyone know how this is possible?
Check out the section "How to steal focus on 2K/XP" at http://www.codeproject.com/KB/dialog/dlgboxtricks.aspx, as this is exactly what you need. I wouldn't go the taskbar route as the taskbar could be hidden or simply not there.
It's possible. But it's extremely sketchy. Your application may also break with the next version of Windows, since it's undocumented. What you need to do is find the window handle of the taskbar, then find the window handle of the child window representing the button, then send it a WM_MOUSEDOWN (I think) message.
Here's a bit on finding the window handle of the taskbar:
http://www.codeproject.com/
FWIW, the restrictions on BringWindowToTop/SetForeground are there because it's irritating when a window steals focus. That may not matter if you're working on a corporate environment. Just keep it in mind. :)
I used this in a program where I needed to simulate clicks and mouse movements;
Global Mouse and Keyboard Library
To be honest I've never had an issue bringing a window to the foreground on XP/Vista/2003/2000.
You need to make sure you do the following:
Check if IsIconic (minimized)
If #1 results in true then call
ShowWindow passing SW_RESTORE
Then call SetForegroundWindow
I've never had problems that I can think of doing it with those steps.