Jump to content

Help me find hex codes of OEM media keys?

Recommended Posts


I've got two media keys I would like to rebind to a function. I have the "Display Switch" key, Fn+F8, and the "Search" key, Fn+F9. I would also like to completely disable the button that turns off my internet connection, Fn+PrintScr. I have often attempted to take a screenshot and accidentally disconnected myself from a multiplayer game.

How do I find the hex key codes of these multimedia keys? I see everywhere to use misc.au3/_IsPressed(), but that would require me to already know the key code.


Thanks for any help.

Share this post

Link to post
Share on other sites

I have the following code getting me the key codes in a message box. Now I can't figure out how to use the key code.

Here is the script to get the key codes:

#include <misc.au3>

While True
    For $k = 0 To 255
        If _IsPressed(Hex($k)) Then
            MsgBox($MB_SYSTEMMODAL, "Key Pressed", Hex($k))


This is what I have tried to listen to the key press:

; Display Switch = 00000050
; Search =         00000053

HotKeySet("{ASC 00000050}", "SendMsg")

Func SendMsg()
    MsgBox($MB_SYSTEMMODAL, "Key Pressed", "Key Pressed")

But nothing happens. I have also tried {ASC 0x50} and other variations I could think of.

And as I just wrote that last sentence I realized that ASC simply uses an ASCII character, not the key codes. Oh well, I'll leave it in the post. The question becomes: How do I use the hex key codes to trigger a function?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now