Author Topic: My XMPlay MultiMedia Keys Control Plugin.  (Read 19917 times)

olesio

  • Posts: 10
My XMPlay MultiMedia Keys Control Plugin.
« on: 4 Apr '11 - 14:42 »
Hello. This is my first post here. At start I want to say XMPlay is great, but I missed one feature to control XMPlay Play/Pause, Prev, Next and Stop using my Manhattan Multimedia Keyboard when XMPlay window will be inactive. It is exist one extrernal program which use multimedia keys but it always set focus to XMPlay window probable to simulate pressing keys instead of sending message to window. So I wrote plugin in Delphi (7 - Personal), because it is only programing language I know good (better than any other and C++). I translated C++ SDK *.h into Object Pascal with small help by Azarien from http://forum.4programmers.net. I attached plugin with compiled dll and source code. Plugin should work ok with other Multimedia Keys in modern keyboards. If someone know Delphi and find some error in xmpdsp.pas or xmpfunc.pas files (when something will be different than original C++ source) please let me know. Anyway, from my fast tests - all seems to work ok. And sorry for my bad English.

EDIT: now attached version 0.2 of my plugin.
« Last Edit: 6 Jun '13 - 04:57 by olesio »

Dotpitch

  • Posts: 2878
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #1 on: 4 Apr '11 - 15:31 »
That is nice :). The commands coming from the keyboard when pressing the media keys, do they differ a lot between vendors?

Pike84

  • Posts: 1398
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #2 on: 4 Apr '11 - 18:11 »
The program seems to require XMPlay to reside at "C:\Program Files". Is there a way around this?

saga

  • Posts: 2301
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #3 on: 4 Apr '11 - 23:08 »
Actually the multimedia keys send the same key messages on most keyboards; However, if you have the vendor's own keyboard software running (f.e. IntelliType with Sidewinder keyboards), the commands are not passed to XMPlay's global key feature anymore; As I don't use the macro keys of my Sidewinder very often, my solution was to simply prevent itype.exe from starting with windows automatically, so I can use multimedia keys as global keys in XMPlay again.

olesio

  • Posts: 10
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #4 on: 5 Apr '11 - 14:52 »
The program seems to require XMPlay to reside at "C:\Program Files". Is there a way around this?
Ignore my *.bat file which was included, because I placed only for myself to pack xmp_mmkeys.dll file with UPX and rename it to xmp-mmkeys.dll. Because in Delphi units cannot be named with '-" char and XMPlay require plugins have filenames xmp-*.dll. So you do not need to have XMPlay installed in the same dir as in my system. Just copy xmp-mmkeys.dll to your XMPlay directory, restart XMPlay and add a DSP plugin named "MultiMedia Keys Control" with "Add" button to list in XMPlay "Options and stuff" dialog. I included new file with source in separate version and recompiled with new version of System module from http://blog.synopse.info so the dll after packed is a little bit smaller. Also to easy click fixed zip archive is attached to this reply like for first post in this thread.

Reply to rest responders: I do not know how it will be in other keyboards but I tested in my father laptop extrnal nonamed keyboard and the vkcodes of multimedia keys are the same. One my friend also test it and have exacly vkCodes of keys like Play/Pause, Prev, Next and Stop. I wrote this plugin to my satisfaction and for people like me who do not like Media Keyboard 2 Media Player (MK2MP) application from http://www.paraboliclogic.com/programs/mk2mp which brings focus to XMPlay window while it is not active or when it is minimized. Btw I have "Notify me of replies." options checked but I did not get any e-mail notifications, I thought noone replies to this thread yes. So I checked manually and what a surprise :)
« Last Edit: 5 Apr '11 - 15:09 by olesio »

brunoaguirre

  • Posts: 1
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #5 on: 14 Apr '11 - 13:34 »
Great Plugin, Worked just fine. I tested it on Windows 7 Enterprise.

Thanks a lot!

olesio

  • Posts: 10
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #6 on: 14 Apr '11 - 15:51 »
Great Plugin, Worked just fine. I tested it on Windows 7 Enterprise.

Thanks a lot!
I'm glad you enjoyed my plugin. Thank you for feedback :)

dasawa

  • Posts: 1
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #7 on: 14 Apr '11 - 17:34 »
work great with me  :D .. thank

rikels

  • Posts: 1
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #8 on: 21 Aug '11 - 09:28 »
it works great, firsly i used media keyboard 2 media player. but this works way better!

olesio

  • Posts: 10
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #9 on: 22 Aug '11 - 03:08 »
Thanks again for feedback. I attached recompiled version with source to this post. Now ii was compiled with changed Delphi 7 modules from http://kolmck.net for WinAPI source codes. And after packed with UPX output dll library have only 5 120 bytes. Enjoy :)
« Last Edit: 22 Aug '11 - 03:11 by olesio »

jwbodnar

  • Posts: 9
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #10 on: 14 Oct '11 - 00:39 »
Hi Olesio,

Thanks for your great work.  Unfortunately, the stupid McAfee virus scan agent thinks your plug-in is the MultiDropper-JD virus.  I thought this might be because of the UPX packer, so I decompressed it on a Linux machine, but McAfee still barks at the decompressed DLL.

There's probably not much you can do about this, but maybe it's a problem for someone else, too.  Lucky for me, I can run your original version, which McAfee thinks is OK.

olesio

  • Posts: 10
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #11 on: 15 Oct '11 - 16:41 »
Hmmm, you should change your antyvirus. I attached source code and like you see there is no malware there. Probable keyboard hook method is detected as virus. But my Kaspersky Anti Virus 2010 do not detected this code as malware, only show warning if hook method is used in separate exe file, because sometimes some script kidies use it to make a keylogger.

Jimmy Neutron

  • Posts: 476
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #12 on: 15 Oct '11 - 17:51 »
In general, false positives are the fault of the anti-virus software.  The way to "fix" the issue is to either tell your anti-virus that the software is OK (and that way it won't keep flagging the software) or better yet... tell the people who make the anti-virus software that they are responsible for false positives.  You submit the software to them, and they can figure out why their anti-virus software has a problem.  This is the only way to make the anti-virus software smarter.

DragonM

  • Posts: 1
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #13 on: 1 Jun '12 - 01:07 »
At last, native multimedia keys support.  Great work, great plugin, works perfectly in Windows 7 Ultimate.  This plugin is a lifesaver.  My Logitech keyboard is so old, the Logitech software doesn't work in Windows 7, which was what I was using to translate multimedia keys for XMPlay in Windows XP.  Now I don't have to translate.

XMP goodness for all!  ;D

DM

olesio

  • Posts: 10
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #14 on: 6 Jun '13 - 04:55 »
Hello all :) I'm back after very long time period. To this post I attached version 0.2 of my plugin for XMPlay to support multimedia keys. I complete rewrite it. So please update it to this version. Now it do not use global lowlevel keyboard hook. So it should works fine under OS with UAC and/or when running without admin rights and do not cause false positives on some rare Anti Virus software. Now it use method idea like hotkeys code taken from program "Cheat Engine" source code. So they are global. Source code in Delphi 7 compiled with http://kolmck.net/sys/SysDcu7.zip modules - included. For all who want to be sure dll is 100% clean of malware - please look at this VirusTotal report: https://www.virustotal.com/pl/file/def6d025c5d2323aafcf75ccdad255d1f23f8c67c10b9ad792a64c3de686bc00/analysis/1370490614/ - I decided to rewrite this plugin because I do something similar for WinAmp, if ACDSee window is active and Multimedia keys do not work then. Also new version was attached to first post in this thread. That's all. Enjoy new version of my small plugin and sorry for my bad English. Now time to get some sleep ;) Best regards.
« Last Edit: 6 Jun '13 - 05:00 by olesio »

Alt

  • Posts: 69
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #15 on: 11 Jun '13 - 15:35 »
olesio,
Thank you for the update.
Sadly I have to use previous version because v0.2 gives me 'DDE Server Window: xmplay.exe' error upon closing. My OS is XP/2003.
« Last Edit: 11 Jun '13 - 15:37 by Alt »

olesio

  • Posts: 10
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #16 on: 11 Jun '13 - 17:11 »
Hmmm, strange. I cannot reprouce that error. My plugin do not use any DDE code. So I do not have idea why it happend. Anyway, if you do not have any problem with 0.1 - global low level keyboard hook version - you can still use it. I had hoped version with reading keystrokes in thread procedure with loop will be better for people, who use modern systems with UAC enabled.

integrator

  • Posts: 1
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #17 on: 2 Jan '14 - 19:01 »
As a feedback:

- Version 0.2 does not work for me (no reaction on Multimedia keys)
- When plugin is added, I receive an error upon closing xmplay (works again properly once plugin is removed)

System: Windows 7 Pro (German)
XMPlay: 3.8.0.2
Keyboard: Microsoft Keyboard 3000 v2 with Intellitype driver (itype.exe)

Error message recorded in system log upon closing (sorry, all in german):
Name der fehlerhaften Anwendung: xmplay.exe, Version: 3.8.0.0, Zeitstempel: 0x52b87122
Name des fehlerhaften Moduls: xmp-mmkeys.dll, Version: 0.0.0.0, Zeitstempel: 0x2a425e19
Ausnahmecode: 0xc0000005
Fehleroffset: 0x00001234
ID des fehlerhaften Prozesses: 0x620
Startzeit der fehlerhaften Anwendung: 0x01cf07eb57c0a7b3
Pfad der fehlerhaften Anwendung: C:\Program Files (x86)\xmplay\xmplay.exe
Pfad des fehlerhaften Moduls: C:\Program Files (x86)\xmplay\xmp-mmkeys.dll
Berichtskennung: aadacd4f-73de-11e3-99f3-002618a93d52


What I really find strange:
Even with running Intellitype drivers (itype.exe), all other applications can properly react on Multimedia buttons
(itunes, winamp, ... even my own Java programs (using JIntellitype from Melloware)).
So as a XMPlay Newbee (changing from Winamp) I still wonder why XMPlay has so many difficulties with this ;-)

Regards,
Mario

piovrauz

  • Posts: 970
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #18 on: 2 Jan '14 - 19:17 »
Well, there's a simpler solution, use XMPlay Shortcuts! XD (well, workaround, if you need intellitype)
For example, I want to bind the Play multimedia button to Play/Pause of XMPlay: go to Options, choose Shortcuts, select "Current Track - Play / Pause", click on the "Click here to enable the shortcut", click on Multimedia button on your keyboard, select the new shortcut (in my case I got a new shortcut to my 0xB3 button), select "make global", and that's it.
« Last Edit: 2 Jan '14 - 20:51 by piovrauz »

saga

  • Posts: 2301
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #19 on: 2 Jan '14 - 21:06 »
Well, there's a simpler solution, use XMPlay Shortcuts! XD (well, workaround, if you need intellitype)
For example, I want to bind the Play multimedia button to Play/Pause of XMPlay: go to Options, choose Shortcuts, select "Current Track - Play / Pause", click on the "Click here to enable the shortcut", click on Multimedia button on your keyboard, select the new shortcut (in my case I got a new shortcut to my 0xB3 button), select "make global", and that's it.
From experience I can tell that these will mysteriously refuse to work if itype.exe is running. Even if you remove media keys from the IntelliType config completely.

piovrauz

  • Posts: 970
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #20 on: 2 Jan '14 - 22:09 »
Too bad. I hate how those SW for KB cause more harme than helps. :P

Jace

  • Posts: 825
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #21 on: 4 Jan '14 - 21:30 »
I've found it much more hassle-free (not to mention infinitely more flexible) to get rid of keyboard software and use AutoHotKey for the common shortcut buttons instead.

piovrauz

  • Posts: 970
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #22 on: 4 Jan '14 - 22:01 »
@Jace: eh, I personally hate those KB utility SW, they always mess something up, and they take a lot of resources too.
I'm curious what would happen with my KB "helper", as I didn't even install it as I have no need for it.
AutoHotKey is a viable solution, and it's not even brand specific, it may y be the right solution, even better than a XMPlay plugin.

DimitarSerg

  • Posts: 3
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #23 on: 9 Jun '14 - 14:17 »
Thanks for this nice plugin, I use XMPlay more than 2 years but few months ago I bought multimedia keyboard. It works with Aimp and Winamp but doesn't work with my favourite player XMP. Then I found this topic add plugin to XMP and my multimedia keyboard keys have work. But when I close player I get Error:
---------------------------
DDE Server Window: xmplay.exe - Ошибка приложения
---------------------------
Инструкция по адресу "0x00b22ba6" обратилась к памяти по адресу "0x00b30004". Память не может быть "read".

I debugged it with OllyDbg and found that it was Exception C0000008 (INVALID HANDLE)
Procedure EndWorkOfGlobalHotKeys called from UnregisterGlobalHotKey and from finalization part.
I commented the call in finalization part in global_hotkeys.pas and rebuild plugin and now I have no Error message :)

I attached my fix.

olesio

  • Posts: 10
Re: My XMPlay MultiMedia Keys Control Plugin.
« Reply #24 on: 9 Jun '14 - 23:34 »
Thanks for feedback. Now I know where can be error code which cause problem with DDE text on some OSes or machines. I try to fix that and update attachment. But now now. sorry, too much beers on bbq meeting with friend on fresh air :)