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

33 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. Great work and very nice content...
    this post is very interesting and knowledgeable for me...
    thanks for sharing this post...
    More info:- Asus Technical Support

    ReplyDelete
  24. 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
  25. Thanks! Works on asus g46vw with iTunes on Windows 8.1 update.

    ReplyDelete