C# - Using FN+Fkeys with SendKey? [duplicate] - c#

This question already has answers here:
How can I simulate function key combinations using C#?
(2 answers)
Closed 7 years ago.
So, I've created an on screen keyboard which is working great - except on my current keyboard I press FN and F1 (for example) and my screen brightness increases. F2 decreases, F5 turns backlit keyboard on/off etc etc
Can I recreate this on my keyboard? I thought maybe there would be someway of seeing how it works currently and adding that to my code? But I'm just a beginner so I don't really know.
I don't imagine there is a SendKeys parameter to handle this, so is there a work around?
Cheers!

The FN key modifies the key code being sent. So to do this (since the FN key acts as a hardware modifier as opposed to ALT, SHIFT, etc.) you could create a MessageBox that displays the key code whenever you press a key and use the values it gives you with these codes

Related

wpf how to view desktop or go desktop by using user32 [duplicate]

This question already has answers here:
Programmatically show the desktop
(2 answers)
Simulating Key Press C#
(8 answers)
Closed 11 months ago.
hi i want to create application when i click the button it go to desktop, i mean when you press Win + D it go to desktop directly, i want to use user32 to be more practical, I want to use this method in the future too, but how?
i dont want to use this way, this road is a little weak :
II.Keyboard.KeyDown(VirtualKeyCode.LWIN);
II.Keyboard.KeyPress(VirtualKeyCode.VK_D);
II.Keyboard.KeyUp(VirtualKeyCode.LWIN);
thank you for answer

PostMessage, how to send CTRL BUTTON? [duplicate]

This question already has answers here:
Sending CTRL-S message to a window
(2 answers)
Closed 3 years ago.
I'm using C#.
I have process file and I can send via PostMessage for example button 'W'.
I have idea how to make shortcut -> I want to spam each milisecond button "CTRL" (works for button "S" cuz I checked it) and then send "W" button.
But my problem is I don't know how to send 'CTRL" via PostMessage
Any suggestions?
You can send it as any other key.
The code for Ctrl key is 0x11, so you would do:
PostMessage(handle, KEY_DOWN, 0x11 /*CTRL_KEY*/, 0);
Sorry, may bad. Based on this answer: https://stackoverflow.com/a/5145435/9748260, you cannot do that, and modifier keys cannot be simulated with SendMessage, so I guess this goes for PostMessage too.

How to simulate android back button press programmatically in Unity with C# [duplicate]

This question already has an answer here:
How to access mobiles back button in unity for android applications
(1 answer)
Closed 4 years ago.
I have done the same thing in android natively by simply calling onBackPressed().
I've been trying to do the same thing in Unity with c#. there are classes like Input that handles inputs but does not have access to android's back button.
I've also seen touch simulators and whatnots but I'm looking for something as simple as calling this.onBackPressed().
Please note that I'm not looking to capture back button press, I want to press back button from my code.
I've been using this.
if(Input.GetKeyDown(KeyCode.Escape))

what is the SendKey for Windows Key [duplicate]

This question already has answers here:
How to press the Windows key programmatically using C# SendKeys
(4 answers)
Closed 8 years ago.
I want to know the sendkey for windows key (that key in keyboard with windows Flag on it)
I don't think you can easely call the windows flag key. You will need to p/invoke an API function instead, I think it was keybd_event to send the Windows key.
check Click here Or Click Here

Programmatically execute Ctrl-H [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
C# Simulate Key Press
I need a way in C# to "type" Ctrl+H in code when a user clicks a button. I am working on a Word addin that customizes the ribbon. When a user clicks my "Replace" button, I want the Replace dialog to show. I can't figure out how to get to that dialog box, but Ctrl+H brings it up. Is there a way to do that?
Take a look here at handling different key combinations. Are you using VSTO?
EDIT: Just reread and understand you're looking at typing those keys! I'll adjust accordingly!
EDIT: The question here covers simulating key presses.

Categories