Saturday, September 22, 2012

How to get ASUS notebooks' media keys to work with Winamp/MusicBee/Etc

Let me say it clearly: ASUS I Hate you.
Ok, actually I don't hate asus. They make great products. I'm just ranting about the fact that they limited their notebooks' media keys to work only with, say, Windows Media Player or Media Center.

I was a big Winamp user (I recently switched to MusicBee) and I was desperate to find a way to make my media keys work with it so I could play Left4Dead and skip songs while playing.

After hours of googling I found the answer: http://zaak404.wordpress.com/2011/05/09/controlling-foobar2000-with-asus-g73-media-keys/
All you have to do is to replace ASUS' DMedia.exe (C:\Program Files (x86)\ASUS\ATK Package\ATK Media) with the supplied one and you are almost done. Zaak404's versione requires you to write a small configuration file to make his program interact only with one single media player... I'm lazy (and I reinstall windows frequently) so I made my own version of his program and it doesn't require any user effort.

So, kudos to zaak404 for doing all the real (read "hard") work on this code. I just edited it to make it work "globally". I'm using windows' keybd_event function, which has been around from win 3.1 I think :D It's deprecated, but it still works in windows 7 so... I don't give a fuck about it ;)

I packed the binary in a Zip file with a .bat file. To install it just right-click install.bat and run it as administrator. Now restart your PC and all should work fine. If it doesn't it probably means ASUS changed the default DMedia.exe's directory, so you have to find the new one and copy manually .\bin\Release\DMedia.exe.

If you have any other problem, just drop a comment below.

Download .ZIP
Repository@BitBucket

54 comments:

  1. Nice done. Cheers mate :)

    ReplyDelete
  2. Thank you for taking the time to write the original code ;)
    Btw, I noticed with my new asus pc that if I replace the original EXE and restart this utility doesn't work, but if I delete the EXE and put the utility in the autostart folder it works... Who knows wtf goes wrong ahah :D

    ReplyDelete
    Replies
    1. Not sure you can see this anymore, but I tried it myself but it does not seem to be working. I replaced the Dmedia file with the one from the zip you had and then ran the batch file as well and restarted my computer and it does not seem to be working for things like itunes or zune player. Am I doing something wrong, or is that just not the function of this file?

      Delete
  3. 3mpty, I tried all the methods u mentioned but the shortcut is not launching MusicBee in my ASUS U46E. help!!

    ReplyDelete
  4. What do you mean by "launching"?
    This utility only works with Play/Stop/Prev/Next keys.

    ReplyDelete
  5. Hey, I wonder, is there a way to remap Fn+arrows to Home-PgUp-PgDown-End instead (MacBook-style)? Thanks a lot in advance!

    ReplyDelete
  6. Okay, nevermind, made it myself. Just used this piece of code: https://gist.github.com/4105624/download# and changed VK_MEDIA_PLAY_PAUSE to VK_NEXT and so on. Works like a charm, thank you very much!

    ReplyDelete
  7. This is fantastic, as I can now use the media keys with iTunes and the Music app (Windows 8). Just one thing, the calculator key (Fn + NumericKeyPadEnter) seems also to be managed by DMedia.exe and so no longer functions. Not a big deal, but would be great if this functionality could be included.

    ReplyDelete
  8. In my notebook it works like a charm :/

    ReplyDelete
  9. Same problem here
    Calculator key (Fn + NumericKeyPadEnter) not working anymore.
    I'm on windows 8 too.

    ReplyDelete
  10. Guys, I don't have a Windows 8 machine around so I'm not gonna fix it any time soon. If someone of you has coding skills he could try to hack the code in some way and I'll be happy to merge the patch.
    I reccomend you to point your browser to zaak404 original application. It requires a little bit of setup but it's a much much cleaner solution so probably it won't mess up with the calculator key.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
  11. This comment has been removed by the author.

    ReplyDelete
  12. Hi 3mpty, thank you for your great work and for the replay. Unfortunately I have zero coding skills :(
    As I can see that you have an ASUS laptop you may be interested in this:
    http://forum.notebookreview.com/asus/150016-asus-notebook-keys-v1-3-a-24.html
    You can remap other Fn functions with it.
    The link is from the last page with the last post being mine as I have a problem with it and I'm hoping that you may have the time and you are kind enough to help me.
    Thank you in advance.
    Liviu

    P.S. Where are you from? (Esti roman?)
    You can contact me at liviupreda2003@yahoo.com
    Mail or Yahoo Messenger.

    P.S.2 Sorry for the comments mess :|

    ReplyDelete
  13. My antivirus has recognised this as a virus (trojan) and wont let me install it unless I turn off antivirus. I turned off and installed, but as soon as I turn antivirus back on it wipes the file... anyone else had this problem?

    ReplyDelete
  14. LOL had same problem with one of the latest update of Avast. I just sended them a false positive report and in the next update it wasn't recognised as a malware anymore. Kinda annoying.
    Obviously you have no reason to trust me, but the source code is on BitBucket and it's something like 40 lines of (real) code.

    ReplyDelete
  15. Worked flawlessly. Thanks!

    ReplyDelete
  16. Hi 3mpty. This program requires administrative privilege every time I log on. Is there anyway to get rid of it?

    ReplyDelete
    Replies
    1. Maybe try something like this: http://www.techrepublic.com/blog/windows-and-office/run-uac-restricted-programs-without-the-uac-prompt/

      Delete
  17. can anyone teach me how to use this app, because i'm not good enough on C++ (T__T)

    ReplyDelete
  18. If you install this and it still isn't working in winamp... make sure you enable Global Media Hotkeys in winamp. They were disabled in my fresh install.

    ReplyDelete
  19. You are a NATIONAL HERO. Thank you.

    ReplyDelete
  20. GOD (OF YOUR CHOICE) BLESS YOU!
    Your solution is the only one that works with my N55SF
    wow so good

    ReplyDelete
  21. Works on Asus X550 with Windows 8. Thanks a lot for this man.

    ReplyDelete
  22. hello, ive tried all this but im still having trouble with spotify, maybe there is a diference in programs?

    ReplyDelete
  23. Hi it works but I also have Avira antivirus saying it's a trojan...
    How can I be sure it isn't?

    The version of zak404 here didn't trigger the antivirus.
    http://zaak404.wordpress.com/2011/05/09/controlling-foobar2000-with-asus-g73-media-keys/

    Best,
    Adrien

    ReplyDelete
    Replies
    1. Then fill in the form for false positives on avira's website please. I think zaak404 used microsoft compiler while I've used CYGWIN (if I remember right).
      I had to do the same with Avast. Anyway if you don't trust me you can look at the code and compile it by yourself.

      Delete
  24. Thanks! Works on asus g46vw with iTunes on Windows 8.1 update.

    ReplyDelete
  25. Thank you for your good work! :)

    ReplyDelete
  26. Thanks a lot for this fix !
    Unfortunately, the fix is broken when the Microsoft "Mouse and keyboard center" is installed. You have to choose !
    http://www.microsoft.com/hardware/en-us/downloads/mouse-keyboard-center

    ReplyDelete
  27. Great work and thaks for sharing!

    ReplyDelete
  28. It is working fine with itunes/windows 8.1! :) Exactly what I needed, thank you so much!

    ReplyDelete
  29. Works on Asus N56VB + Win7 at glance.
    Many many thanks!

    ReplyDelete
  30. Awesome work, thank you. Works flawlessly with iTunes on Win8.1 Pro on K53sv. Also the calculator shortcut still works.

    ReplyDelete
  31. Thank you for your this, works perfectly fine. Simple instructions.

    ReplyDelete
  32. Thanks much. Works great.

    ReplyDelete
  33. Sweet god! Thank you very much! (Working with latest iTunes and N61JV)

    ReplyDelete
  34. Thank you!! :-) Very easy. Working on S56CA with Windows 8.1 and using Prime Player for google play music.

    ReplyDelete
  35. The file is whitelisted now by eset.

    ReplyDelete
  36. Anyone tried this on Windows 10?
    For me, it works as it normally did. I can't get the play/pause keys to work globally using KMPlayer.

    ReplyDelete
  37. I am from th future and I tell that this works with Asus N53SM, Windows 7.

    Yeah, in the future we still use Windows 7.

    ReplyDelete
  38. Thanks man!! It works on Asus S400C usign Spotify :D

    ReplyDelete
  39. Why my Winamp needs to be in front to work this? If it's minimized the keys doesn't work!

    ReplyDelete
  40. I JUST LOVE YOU GUY!
    Fixed my S550C, now using keys with Spotify. Many thanks.

    ReplyDelete
  41. Hey, thank you for your time editing the codes. It works great on my Asus. I am using foobar. Thanks again :)

    ReplyDelete
  42. Works like a charm. I thank you for this, kind sir.

    Also, yes, virustotal gives it a 25/56 score but it's NOT a trojan.

    ReplyDelete
  43. Hi! Know i have windows 10 and the latest atk package, but your codes aren't working with me. Could you help me?

    ReplyDelete
  44. Seems to have stopped working for me (Windows 7 64 Bit) somehow, at least it doesn't work with MusicBee 3.2 anymore and I think it used to work in the beginning.
    Maybe it's really time to replace my notebook finally...

    ReplyDelete
  45. Thank You and I have a dandy provide: What Renovations Increase The Value Of A Home average home renovation cost

    ReplyDelete