How can I simulate function key combinations using

2019-01-28 05:53发布

I was hoping someone could help me with simulating a function key combination in C#, in this case FN + F4.

Here's what I'm trying to do... I have an older touchscreen netbook that I recently installed Windows 8 on. It has a swivel screen so you can fold it down and use it like a tablet. Windows 8 runs surprisingly well on it. I had a few minor issues, most of which I was able to work out, but one remains.

When you first power up the netbook or wake it from sleep, the screen is at 30% brightness, and Windows thinks that this is the max setting, so increasing the screen brightness through the normal methods does not work. On my netbook, pressing FN + F4, restores the screen to full brightness. This is a minor annoyance though, because I have to swivel the screen back and forth to fix the brightness using the physical keyboard, when I'd like to just leave it in the tablet position and minimize wear and tear.

What I'd like to do is write a little application that runs on start up, and simulates the function key combination, so the brightness is restored automatically. Any suggestions would be greatly appreciated. Thanks.

2条回答
我想做一个坏孩纸
2楼-- · 2019-01-28 06:14

The Fn key is not a key that is sent from the keyboard to the computer. It is actually used to change the meaning of keys on the keyboard (such that the keyboard sends different scancodes when the key is pressed with Fn held down).

You should be able to easily write a simple Windows Forms program that listens to key presses and shows you what has been received. Register for the KeyDown event. The KeyEventArgs your handler receives has various properties that you can inspect to see what is being received.

查看更多
冷血范
3楼-- · 2019-01-28 06:18

The FN key isn't a real keyboard key like the other modifiers (shift, alt, ctrl) nor is it a function key like the F1 - F12. The FN key is a hardware only key that simply tells the hardware to send a different keystroke while the FN key is being pressed.

So, you are going to have to adjust the brightness manually like "m-y" stated in the comments or through some other mechanism.

Reference Link.

查看更多
登录 后发表回答