zaak@blue:~$

Controlling foobar2000 with Asus multimedia keys

with 58 comments

From about two months I’m a happy owner of Asus G73SW. In this model with four media keys, which in fact are keyboard shortcuts, you can control multimedia apps. However, with standard software shipped with notebook you are able to control just two of them: Roxio Cineplayer and Windows Media Player. Unfortunately, there’s no support for other multimedia applications. As I don’t use none of these I wanted to make multimedia keys work with foobar2000. In effect I’ve developed a small application, which allows you control foobar with Asus multimedia keyboard shortcuts. I’ve tested it only with Asus G73SW, ATKHotkey 1.0.58.5 and foobar2000 1.1.5. On my machine it works just fine, and I think there’s still chance to make it work with other Asus notebooks models (feel free to add a comment if this solution worked for you).

Download link: [ATKMediaInterceptor]
Source: [ATKMediaInterceptor source]

To make it work (or better say, to try make it work) perform following steps:
1. Download application from the first link given above.
2. Open task manager, find process named DMedia.exe and terminate it.
3. Unpack zip file, and copy files to ATK Media installation folder. For example, on my machine it’s C:\Program Files (x86)\ASUS\ATK Package\ATK Media. You have to copy both files there and overwrite existing executable named DMedia.exe. Better solution is to change old executable name (to DMedia.exe.old for example) and keep it in case you will want back to it someday.
4. Now you just need to restart your machine.

If everything went as should, from now you should be able to control foobar with your media shortcuts:
Fn + Down arrow – Play/Pause
Fn + Up arrow – Stop
Fn + Left arrow – Previous track
Fn + Right arrow – Next track
Each of them also launch player if it wasn’t started yet.

Configuration file icpt.conf keeps two configuration options. First is window class name used by WinAPI FindWindow function to find foobar2000 window, second is path to application that will be executed in case the player window wasn’t found.

About these ads

Written by zaak

Maj 9, 2011 @ 3:45 pm

Odpowiedzi: 58

Subscribe to comments with RSS.

  1. Hey, tried this on my Asus X5QSF (same as N5SF) and this is exactly the solution I was looking for! Works like a charm :D
    Thanks for the great work, I’ll recommend it to others!

    René

    Grudzień 5, 2011 at 12:59 pm

    • I’m glad I could help :)

      Cheers!

      zaak

      Grudzień 5, 2011 at 2:05 pm

  2. what win api code should i put inside if i want play pause next and previous controls to be global, like in winamp, aimp, media player and all that? :P
    or just AIMP for begining

    Marko Žutić

    Grudzień 10, 2011 at 2:42 am

    • In the current version there’s no way to make it work globally. But if you want to control any other media app (e.g. AIMP) you need to replace the window_class option in the conf file. You can get the window class name using an appropriate tool – I can recommend Window Detective.

      zaak

      Grudzień 10, 2011 at 8:31 am

      • How about using SendInput function from Winuser.h?

        Would do it myself, but I don’t have much experience with Windows API (especially as low level for me as in C ;) ).
        Information about SendInput found here: http://stackoverflow.com/questions/2969115/how-to-simulate-multimedia-key-press-in-c.

        SHA da Vinci

        Styczeń 10, 2012 at 11:46 pm

      • @SHA da Vinci: Thanks for the hint. Yes, in some cases SednInput would be better (if not only) choice, but it’s a bit more complicated. I don’t see a reason for using this in such a simple app, but I’m not a WinAPI ninja though :)

        zaak

        Styczeń 11, 2012 at 7:48 am

    • Hey, got it working for Winamp as well! Very nice, thanks again for the instructions :D
      Found with Window Detective what the windowclass should be, now works great!
      For others who want to let it work with WInamp, this is what my icpt.conf looks like now:

      window_class=BaseWindow_RootWnd
      application_path=C:\Program Files (x86)\Winamp\winamp.exe

      René

      Grudzień 19, 2011 at 4:36 pm

      • Hey, that’s cool! Thanks for the feedback :)

        zaak

        Grudzień 19, 2011 at 5:17 pm

  3. It’s great, thanks! Works flawlessly on my K52J.

    NaOH

    Grudzień 22, 2011 at 4:07 pm

  4. Thanks you so much, works like a charm on my K53E!

    dagem

    Styczeń 8, 2012 at 3:26 pm

  5. By the way – what IDE/compiler do you use?

    Already tried good ol’ Dev-C++ but when including winuser.h (necessary for sendinput function) header it doesn’t work (compiler finds some errors in winuser header – if it’s possible). Would porting this code to VS C++ project be hard?

    SHA da Vinci

    Styczeń 12, 2012 at 12:33 pm

    • I use both – cl from Visual Studio and gcc. The linked app was compiled with gcc 4.5.2 (so the only dll dependency is msvcrt.dll). The code is pretty ugly, but no changes are required to compile this in VS, just checked :) Although you may need to change some project options.

      zaak

      Styczeń 12, 2012 at 1:31 pm

  6. I did what Rene asked to. But the hotkeys only called up Winamp and not do anything

    mriak

    Styczeń 16, 2012 at 3:05 pm

    • Hi I solved the problem. You have to enable everything in Winamp’s global hotkeys.

      mriak

      Styczeń 16, 2012 at 5:37 pm

  7. Works for me also! N53SN Thanks Dude!

    Sial

    Styczeń 21, 2012 at 10:01 pm

  8. Thanks so much, working like a charm!

    wunnle

    Luty 7, 2012 at 3:59 pm

  9. That’s how it works with MusicBee: window_class=WindowsForms10.Window.8.app.0.378734a
    application_path=C:\Program Files (x86)\MusicBee\MusicBee.exe
    Finally Fn keys work properly. Thanks, dude, great work!

    Ivan

    Luty 22, 2012 at 9:39 pm

  10. Nice! works great with my Asus G50VT-X1 and Winamp, thank you so much! and thanks to René for the information about the modification.

    Germán Ríos González

    Marzec 26, 2012 at 4:47 am

  11. Works for Spotify too! (Replace USERNAME with your Windows-username)

    window_class=SpotifyMainWindow
    application_path=C:\Users\USERNAME\AppData\Roaming\Spotify\spotify.exe

    Jeffrey van Hees

    Kwiecień 17, 2012 at 8:38 pm

    • Great, thanks! Got it to work with Spotify

      Mo

      Styczeń 19, 2014 at 1:39 pm

  12. Sadly, but haven’t worked for me. Now It’s only opens foobar. Doesn’t play/pause, stop or anything.
    Is there any chance you will fix that?
    I run ASUS ROG G53SX-IX154V and foobar 1.1.11.

    GramLeen

    Maj 21, 2012 at 12:50 pm

    • 1) run Spy++ (can be found in Internet)
      2) get Foobar window class id (in my case: {97E27FAA-C0B3-4b8e-A693-ED7881E99FC1} )
      3) put Id in icpt.conf (next to DMedia.exe above) and save.

      ElDorado

      Czerwiec 18, 2012 at 9:58 pm

  13. For those, who have problems with controlling foobar. If you have done all above and foobar2000 doesn`t obey you, do next:
    1) run Spy++ (can be found in Internet)
    2) get Foobar window class id (in my case: {97E27FAA-C0B3-4b8e-A693-ED7881E99FC1} )
    3) put Id in icpt.conf (next to DMedia.exe above) and save.
    Now foobar will abey you :)

    ElDorado

    Czerwiec 18, 2012 at 9:56 pm

  14. thanks, it works with my Asus K53SJ

    Lukkan

    Lipiec 1, 2012 at 4:41 pm

  15. Thanks!!!! Works in Asus N61JV-X2 with Footbar2000!!!!!!!!!!!

    007felix

    Lipiec 2, 2012 at 10:03 pm

  16. Hi, for me it works with foobar but i have a little problem : the others hotkey like light/ desactivate keyboard etc… don’t work. How to proceed? thanks

    meleor

    Sierpień 15, 2012 at 3:59 pm

  17. It works great with the ASUS G75VW-RS72 and foobar2000 v1.1.14a! All I had to do was get the new class ID using UISpy, which you can download here:

    http://andrewtokeley.net/archive/2009/09/15/uispy-ndash-download-it-here.aspx

    ednos

    Sierpień 26, 2012 at 4:34 am

  18. I managed to make Winamp works by editing the „icpt.conf” file with this content:

    window_class=Winamp v1.x
    application_path=C:\Program Files (x86)\Winamp\winamp.exe

    john mayers

    Wrzesień 14, 2012 at 9:15 pm

  19. This worked great for me on my N55SL. However, since I didn’t need the ability to start a program (Win + 4, Win +5 for the pinned MPC-HC and foobar2000 shortcuts work fine) and I’d rather that the media keys work for all programs, I butchered your wonderful program: https://gist.github.com/4105624

    I compiled using MinGW: gcc -mwindows -Wall -march=native -O2 -s ATKMediaInterceptor.c -o DMedia.exe

    Thank you!

    Faheem

    Listopad 18, 2012 at 2:50 pm

  20. had to tweak the windowclass, but it works perfectly! :)
    thanks!

    Aljoša

    Styczeń 12, 2013 at 9:56 am

  21. Used this 6 months ago on my Asus N55SL;
    came here to say THANKS!

    TaurusThree

    Styczeń 17, 2013 at 6:08 am

  22. Thank you! You really saved my day here >.>
    I still have one problem though, the FN key is still (unknown) when I set the shortcuts, and any command I use with just do Pause/Play.
    And also whenever I use the command the foobar window pops up, is there a way for me to manage it in the background? (very useful when running games).

    I hope this tread is still active! D:

    Tweak Squeak

    Luty 25, 2013 at 5:18 pm

  23. My brother recommended I might like this blog.

    He was entirely right. This post actually made my day.

    You cann’t imagine simply how much time I had spent for this information! Thanks!

  24. Thank you so much! It works with AIMP too:
    window_class=TApplication
    application_path=C:\Program Files (x86)\AIMP3\AIMP3.exe

    kondzioff

    Marzec 29, 2013 at 4:36 pm

    • I wanted to did the same (with AIMP) but I can’t save the config file because Notepad is saying it might be open in an other program. The problem is I can’t find which one. Did you experience the same issue ?

      dvsbstrd

      Kwiecień 3, 2013 at 9:27 pm

  25. Thank youvery much, worked on my ux52vs. Exactly what I was looking for!

    Victor

    Kwiecień 16, 2013 at 10:44 am

  26. To use with vlc:

    window_class=QWidget
    application_path=C:\Program Files (x86)\VideoLAN\VLC\vlc.exe

    Jorge Santos

    Czerwiec 20, 2013 at 7:27 pm

  27. Actually this doesnt work very well, as there are several „qWidget” classes. Is there anyway this can work with .exe file name or the window title?

    Jorge Santos

    Czerwiec 20, 2013 at 11:28 pm

  28. its works pretty good with Media Player Classic Home cinema
    here what you need to write for use MPC

    window_class=MediaPlayerClassicW
    application_path=C:\Program Files (x86)\K-Lite Codec Pack\Media Player Classic\mpc-hc.exe

    but I have one problem when I switch the DMedia in the rar at the original I cannot use the shortcut for the Calculator (Fn+ enter (in the numpad)), it open the MPC
    any help?

    thanks and sorry for my english :(

    Dan

    Czerwiec 22, 2013 at 10:06 am

    • I found a workaround. First of all I found out with the Task Manager that when pressing Fn + Enter it executed „SimAppExec.exe” instead of the Calculator. I found this file in the path „C:\Program Files (x86)\ASUS\ATK Package\ATK Hotkey”, so I deleted it and searched through the Windows folder for „calc.exe” and found the two necessary files to run the Calculator („calc.exe” and „calc.exe.mui”, there are many pairs, just choose one). Then I copied „calc.exe” into the „ATK Hotkey” folder and renamed it into „SimAppExec.exe”, and the same with „calc.exe.mui” into „SimAppExec.exe.mui”, and finally I moved the latter into a new folder called „es-ES” (which depends on the language of your system, hint: when searching for „calc.exe” you have to look the name of the folder that contains „calc.exe.mui”).

      Thynaks

      Sierpień 11, 2013 at 1:26 am

  29. worked with asus n56vz and foobar 1.2.8! thanks a lot :D

    Akash

    Czerwiec 23, 2013 at 11:39 am

  30. Still Working ! , Asus A43SV with Windows 8.1 , ATK from Windows 7 64 Bit ,
    Work with Zune (Not Xbox Music)

    window_class=UIX Render Window
    application_path=C:\Program Files\Zune\Zune.exe

    Steve McTravis

    Lipiec 8, 2013 at 6:00 pm

  31. You are so awesome! I do not suppose I’ve read
    through a single thing like this before. So good to find someone with some genuine thoughts on this subject.
    Seriously.. thank you for starting this up. This site is
    one thing that’s needed on the web, someone with a bit of originality!

    homepage

    Wrzesień 18, 2013 at 12:23 am

    • hi, zaak, why my hotkeys only called up Winamp and not do anything

      is that any other configuration?

      ivan

      Październik 4, 2013 at 2:53 am

  32. hi, zaak, why my hotkeys only called up Winamp and not do anything

    is that any other configuration?

    ivan

    Październik 4, 2013 at 2:54 am

  33. on itunes? any one?

    Daniel Contreras

    Październik 19, 2013 at 8:23 am

  34. Doesnt work with Asus K95VM, but disabled the annoying opening of Windows Media Center with it.

    asda

    Grudzień 30, 2013 at 9:14 pm

  35. I found out how to see MusicBee window_class. By using Autohotkey Window Spy:
    http://xahlee.info/mswin/i/AutoHotkey_Window_Spy.png
    ahk_class is the window_class.

    PS: Your file is offline

    Alex

    Luty 1, 2014 at 11:55 am

  36. Link seems to be dead. Can you reupload the file? :)

    Sial

    Luty 27, 2014 at 9:10 am

    • Done :)

      Cheers

      zaak

      Luty 27, 2014 at 10:36 am

      • There is no „DMedia.exe” file in zip folder. Should i rename „ATKMedia.exe” to DMedia.exe after copying files to ATK Media installation folder?

        Sial

        Luty 27, 2014 at 3:20 pm

  37. Great information. Lucky me I ran across your site by accident (stumbleupon).
    I have saved it for later!

    Thanh

    Kwiecień 6, 2014 at 10:31 am

  38. Doesn’t work on Asus N56VV. Changed window class id and still, your program acts like it isn’t running at all (but it is) and keys still work only with WMP just as before (even without running original DMedia.exe). I am on Windows 8.1. I’ll gladly send more info you want to.

    Hemenex

    Lipiec 7, 2014 at 7:45 pm

  39. If this totally doesn’t work for somebody there is also program called MediaKeys, which allows you to define new keyboard shortcuts for media controls, but you can’t use Fn+key. Alt+arrow works pretty well there.

    Hemenex

    Lipiec 8, 2014 at 8:47 am


Dodaj komentarz

Wprowadź swoje dane lub kliknij jedną z tych ikon, aby się zalogować:

WordPress.com Logo

Komentujesz korzystając z konta WordPress.com. Log Out / Zmień )

Twitter picture

Komentujesz korzystając z konta Twitter. Log Out / Zmień )

Facebook photo

Komentujesz korzystając z konta Facebook. Log Out / Zmień )

Google+ photo

Komentujesz korzystając z konta Google+. Log Out / Zmień )

Connecting to %s

Follow

Otrzymuj każdy nowy wpis na swoją skrzynkę e-mail.