how to disable Keyboard inputs on windows like (temporary) - c#

i have problem i'm trying to do new shortcut but if i put the shortcut i made F11 then will happen is full screen , i want to disable Keyboard inputs form windows or just disable the actions form windows i mean (if i press any key i want to put the action not windows put the action)
i create application that raises the volume , i put the volume up "F11" but in google chrome F11 is full screen, there anther application if i press F11 or F10 or F9 it do something and i dont want this happen.
i'm using Visual Studio Windows forms C#
note: my application work in background (i dont want use From1_KeyUp or Down i know this code)
Thank You for help
enter image description here
2 pictures
enter image description here

To prevent keys from reaching the target application you must use a low-level keyboard hook and return a non-zero value when you performed your own custom action.

Related

C# Disable mouse takeover

I am currently using the windows on screen keyboard to control the program for the cnc machine. In C# I tried to make a simple on screen keyboard with only the keys I need. I use this command to send key
SendKeys.SendWait("{ENTER}");
or
SendKeys.Send("{ENTER}");
The first click works, but then the background program "takes away" the mouse after the click and then I can no longer control it. While such a problem does not occur on the windows on screen keyboard
Is there a way to avoid this, to make it work like microsoft osk?
Thanks

Camera button long press event in windows tablet

I am trying to make a torch application in windows tablet. The ultimate aim is that "User should have immediate access to the torch". I managed to put the application in the settings tab of charms bar. But it requires 2 clicks, first on the setings bar then torch application.
Is it possible to put the application in the charms bar itself?, so the user can launch the application with a single click.
Or is there any way to get a trigger from external keys?. Something
like, "long press on the volume key will launch the application", or "long press on camera button etc..".
Any Help will be highly appreciated :).
First, no way to launch the app in the Charms bar.
You can register a event handler to HardwareButtons.CameraPressed
HardwareButtons.CameraPressed += HardwareButtons_CameraPressed;.
NOTE
By using HardwareButtons you shold first add reference of Mobile Extensions if you are developing UWP apps.

Windows Phone 8 show MessageBox when app closing (deactivated)

I am trying to show user MessageBox just before app is closed (or deactivated). So I added this to both events:
if (AppSettings.ShouldShowAlertTransfer)
{
MessageBox.Show("...");
}
But the MessageBox is not shown. I am adding this because then I am adding background transfers and I must inform user that I created some background trasnfers. I know I can add this code to OnKeyBackPressed in every page. But it's working just for back key and not middle button. And it wouldn't be nice to have same code copied in every page.
So is it possible to show this MessageBox in App.xaml.cs? How can I do that? If it's not how can I show MessageBox when user pressed middle button?
I was intrigued by your question so I opened up a solution and attempted every single override available and every single page event. I also tried all of the methods in the App.xaml.cs.
I can unequivocally say, based on the MSDN documentation and my own personal testing that there is no way to detect the home button press or search button press. Furthermore there is no way to display a message box to temporarily stop one of these actions.
This testing was done on Windows Phone 8 with the WVGA 512MB Emulator in Visual Studio 2013 Ultimate.

Waiting until enter key is pressed in a notepad

I would like to get the previous entered Text message in an open notepad instance until the ENTER key is pressed (asynchronously).
That is, enter "some text is entered [ENTER]" then I like to get the string "some text is entered" (MessageBox.show(sometext);) Would you please offer me an idea of how to do this without use of a global keyboard hook ? Thank you
If keyboard hook does not work - consider spying on the messages sent/handled by the notepad window. Spyxx tool from Visual Studio tools will show messages (note to match 32/64 bit to be able to spy).
Note that it still requires ability to run in another process -
How can my application read windows messages (WM_SETTEXT) from another application? , I would not recommend native code for doing it instead of C#.

detect printscreen

simply put I want my program which runs in the background to check whether the print screen button has been pressed (which mostly triggers a function within another program to generate a screenshot of the current window. eg a game screen).
I have seen lots of possible answers, but most seem overkill for just detecting the print screen button.
I want to have a program in the background check so that it can move the screenshot that has just been made/saved to a certain location. after the button had been pressed.
I hope this question is clear, if not I'll try to explain more clearly.
ps
On a side note, would it be better to try and detect the printscreen button or to simply check the specified folder every 1 or 5 minutes whether a new image has been put in that folder and then move it if true.
EDIT
I decided to use the FileSystemWatch, however it seems to be to fast if i use the on create event as sometimes the file is still being made and it can't move the file yet.
Would the best action be to use a timer to delay ?
You could just watch the folder location for updates using a FileSystemWatcher. There are many examples around the place.
Global keyboard capture in C# application
You should be able to use a global key hook to handle the print screen key press.

Categories