summaryrefslogtreecommitdiff
path: root/plugins/Watrack/players/pl_wmp.pas
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-10-08 18:43:29 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-10-08 18:43:29 +0000
commit864081102a5f252415f41950b3039a896b4ae9c5 (patch)
treec6b764651e9dd1f8f53b98eab05f16ba4a492a79 /plugins/Watrack/players/pl_wmp.pas
parentdb5149b48346c417e18add5702a9dfe7f6e28dd0 (diff)
Awkwars's plugins - welcome to our trunk
git-svn-id: http://svn.miranda-ng.org/main/trunk@1822 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Watrack/players/pl_wmp.pas')
-rw-r--r--plugins/Watrack/players/pl_wmp.pas128
1 files changed, 128 insertions, 0 deletions
diff --git a/plugins/Watrack/players/pl_wmp.pas b/plugins/Watrack/players/pl_wmp.pas
new file mode 100644
index 0000000000..971cb28ac6
--- /dev/null
+++ b/plugins/Watrack/players/pl_wmp.pas
@@ -0,0 +1,128 @@
+{Windows Media Player}
+unit pl_WMP;
+{$include compilers.inc}
+
+interface
+
+implementation
+uses windows,common,messages,srv_player,wat_api
+ {$IFDEF DELPHI_7_UP}
+ ,variants
+ {$ENDIF}
+ {$IFDEF KOL_MCK}
+ ,kolcomobj
+ {$ELSE}
+ ,ComObj
+ {$ENDIF}
+;
+
+const
+ WMPOld:boolean=false;
+
+const
+// CLASS_MP :TGUID = '{22D6F312-B0F6-11D0-94AB-0080C74C7E95}';
+// CLASS_WMP:TGUID = '{6BF52A52-394A-11D3-B153-00C04F79FAA6}'; CLASS_WindowsMediaPlayer
+ MPCOMName = 'MediaPlayer.MediaPlayer.1';
+ WMPCOMName = 'WMPlayer.OCX.7';
+const
+ MPClass = 'Media Player 2';
+ WMPClass = 'WMPlayerApp';
+
+function Check(wnd:HWND;flags:integer):HWND;cdecl;
+begin
+ result:=FindWindowEx(0,wnd,MPClass,NIL);
+ if result=0 then
+ begin
+ result:=FindWindowEx(0,wnd,WMPClass,NIL); //?
+ WMPOld:=false;
+ end
+ else
+ WMPOld:=true;
+end;
+
+{ Version detect
+ fHasWMP64 = (WMP64.FileName="") ' WMP64 was create above via OBJECT tag else this returns False.
+ fHasWMP7 = (WMP7.URL = "") ' WMP7 or later was create above via OBJECT tag else this returns False.
+}
+
+const
+ MPVersion:PWideChar = '6.4';
+
+function GetVersionText(flags:integer):PWideChar;
+var
+ v:variant;
+begin
+ if WMPOld then
+ StrDupW(result,MPVersion)
+ else
+ begin
+ try
+ v:=CreateOleObject(WMPCOMName);
+ StrDupW(result,pWideChar(Widestring(v.versionInfo)));
+ except
+ result:=nil;
+ end;
+// VarClear(v);
+ v:=Null;
+ end;
+end;
+
+function GetInfo(var SongInfo:tSongInfo;flags:integer):integer;cdecl;
+begin
+ result:=0;
+ if (flags and WAT_OPT_PLAYERDATA)<>0 then
+ begin
+ if SongInfo.txtver=nil then
+ SongInfo.txtver:=GetVersionText(flags);
+ end;
+end;
+
+{
+function Command(wnd:HWND;cmd:integer;value:integer):integer;cdecl;
+var
+ c:integer;
+begin
+ result:=0;
+ case cmd of
+// WAT_CTRL_PREV : c:=VK_B;
+// WAT_CTRL_PLAY : c:=VK_C;
+// WAT_CTRL_PAUSE: c:=VK_X;
+// WAT_CTRL_STOP : c:=VK_Z;
+// WAT_CTRL_NEXT : c:=VK_V;
+ WAT_CTRL_VOLDN: c:=VK_F9;
+ WAT_CTRL_VOLUP: c:=VK_F10;
+ else
+ exit;
+ end;
+ PostMessageW(wnd,WM_KEYDOWN,c,1);
+end;
+}
+const
+ plRec:tPlayerCell=(
+ Desc :'WMP';
+ flags :WAT_OPT_APPCOMMAND or WAT_OPT_SINGLEINST;
+ Icon :0;
+ Init :nil;
+ DeInit :nil;
+ Check :@Check;
+ GetStatus:nil;
+ GetName :nil;
+ GetInfo :@GetInfo;
+ Command :nil;
+ URL :'http://www.microsoft.com/windows/windowsmedia/players.aspx';
+ Notes :nil);
+
+var
+ LocalPlayerLink:twPlayer;
+
+procedure InitLink;
+begin
+ LocalPlayerLink.Next:=PlayerLink;
+ LocalPlayerLink.This:=@plRec;
+ PlayerLink :=@LocalPlayerLink;
+end;
+
+initialization
+// ServicePlayer(WAT_ACT_REGISTER,dword(@plRec));
+ InitLink;
+end.