diff options
| author | 2006-12-18 01:34:15 +0000 | |
|---|---|---|
| committer | 2006-12-18 01:34:15 +0000 | |
| commit | c75b9f00eaeee4b8503ba662b3d7ccc9e1914096 (patch) | |
| tree | a5e7ee244fa4124588a114732c4ecbc248c7c199 /src/modules/mediaplayer/winamp.cpp | |
| parent | Switching from cvs to svn, initial import (diff) | |
| download | KVIrc-c75b9f00eaeee4b8503ba662b3d7ccc9e1914096.tar.gz KVIrc-c75b9f00eaeee4b8503ba662b3d7ccc9e1914096.tar.bz2 KVIrc-c75b9f00eaeee4b8503ba662b3d7ccc9e1914096.zip | |
Switching from cvs to svn, initial import
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@14 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/mediaplayer/winamp.cpp')
| -rw-r--r-- | src/modules/mediaplayer/winamp.cpp | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/src/modules/mediaplayer/winamp.cpp b/src/modules/mediaplayer/winamp.cpp new file mode 100644 index 000000000..02b32ee5f --- /dev/null +++ b/src/modules/mediaplayer/winamp.cpp @@ -0,0 +1,147 @@ +// +// File : winamp.cpp +// Creation date : Tue Nov 6 23:01:12 2001 GMT by Szymon Stefanek +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2001 Szymon Stefanek (pragma at kvirc dot net) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program is distributed in the HOPE that it will be USEFUL, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// + +#include <windows.h> +#include <process.h> + + +// +// This is a winamp-kvirc interface plugin +// + +// This stuff is compiled only on windows , as a separate dll module + + +typedef struct +{ + int version; + char *description; + int (*init)(); + void (*config)(); + void (*quit)(); + HWND hwndParent; + HINSTANCE hDllInstance; +} winampGeneralPurposePlugin; + +#define GPPHDR_VER 0x10 + +extern winampGeneralPurposePlugin *gen_plugins[256]; +typedef winampGeneralPurposePlugin * (*winampGeneralPurposePluginGetter)(); + +int init(); +void quit(); +void config(); + + +winampGeneralPurposePlugin plugin = +{ + GPPHDR_VER, + "KVIrc interface plugin 1.0", + init, + config, + quit, +}; + +/* +BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) +{ + return TRUE; +} +*/ + +#define KVIRC_WM_USER 63112 + +#define KVIRC_WM_USER_GETTITLE 5000 +#define KVIRC_WM_USER_GETFILE 10000 +#define KVIRC_WM_USER_TRANSFER 15000 + +#define IPC_GETPLAYLISTFILE 211 +#define IPC_GETPLAYLISTTITLE 212 +#define IPC_GETLISTPOS 125 + +#define KVIRC_WM_USER_CHECK 13123 +#define KVIRC_WM_USER_CHECK_REPLY 13124 + +void *lpWndProcOld = 0; + +char szBuffer[4096]; + +LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) +{ + if(message == WM_USER) + { + if(wParam == KVIRC_WM_USER) + { + if(lParam == KVIRC_WM_USER_CHECK) + { + return KVIRC_WM_USER_CHECK_REPLY; + } + if(lParam == KVIRC_WM_USER_GETTITLE) + { + int idx = (int)SendMessage(hwnd,WM_USER,0,IPC_GETLISTPOS); + if(idx != -1) + { + char * szTitle = (char *)SendMessage(hwnd,WM_USER,idx,IPC_GETPLAYLISTTITLE); + strcpy(szBuffer,szTitle); + return strlen(szBuffer); + } + } else if(lParam == KVIRC_WM_USER_GETFILE) + { + int idx = (int)SendMessage(hwnd,WM_USER,0,IPC_GETLISTPOS); + if(idx != -1) + { + char * szTitle = (char *)SendMessage(hwnd,WM_USER,idx,IPC_GETPLAYLISTFILE); + strcpy(szBuffer,szTitle); + return strlen(szBuffer); + } + } else if((lParam >= KVIRC_WM_USER_TRANSFER) && (lParam < (KVIRC_WM_USER_TRANSFER + 4096))) + { + return (LRESULT) szBuffer[lParam - KVIRC_WM_USER_TRANSFER]; + } + } + } + return CallWindowProc((WNDPROC)lpWndProcOld,hwnd,message,wParam,lParam); +} + +int init() +{ + lpWndProcOld = (void *) GetWindowLong(plugin.hwndParent,GWL_WNDPROC); + SetWindowLong(plugin.hwndParent,GWL_WNDPROC,(long)WndProc); + return 0; +} + +void quit() +{ +} + +void config() +{ +} + + + + + +extern "C" __declspec( dllexport ) winampGeneralPurposePlugin * winampGetGeneralPurposePlugin() +{ + return &plugin; +} |
