Winamp Control Sourcecode

02/19/2010 22:23 Medix#1
Für diejenigen die es intressiert wie die .dll vom Winamp Controller aussieht hier:

Link zum fertigen download:

[Only registered and activated users can see links. Click Here To Register...]



Code:
#include <Windows.h>

/*
WINAMP CONTROL IDS



40044 - Previous track button of WinAmp;
40048 - Next track button of WinAmp;
40045 - Play button of WinAmp;
40046 - Pause/Unpause button;
40047 - Stop button of WinAmp;

*/



typedef void (_stdcall *Print)(wchar_t* Text, char Color);

void D2Print(char* message) {
   wchar_t wBuffer[256];
   MultiByteToWideChar(0, 1, message, 100, wBuffer, 100);


   HMODULE handle = GetModuleHandle("D2Client.dll");
   if (!handle)
      handle = LoadLibrary("D2Client.dll");


   Print PrintMessage = (Print) (((DWORD)handle) + 0x71740);//1.12
   //Print PrintMessage = (Print) (((DWORD)handle) + 0x3F180);//1.13PTR


   PrintMessage(wBuffer, 0);

}
HWND hwndWinamp = FindWindow("Winamp v1.x",NULL); 
char title[3024],*rTitle;


void Title()
{
    GetWindowText(hwndWinamp, title, 3024);
    rTitle = title+strlen(title)-8;
    while (rTitle >= title)
    {

        if (!strnicmp(rTitle,"- Winamp",8)) break;
        rTitle--;
    }
    if (rTitle >= title) rTitle--;
    while (rTitle >= title && *rTitle == ' ') rTitle--;
    *++rTitle=0;
}

DWORD WINAPI MyThread(LPVOID)
{


D2Print("Winamp Control by Medix");
D2Print("F1 = Play/Pause | F2 = Next Track | F3 = Previous Track | F4 = Show current Track");
   for(;;)
    {
    if(GetAsyncKeyState(VK_F4)){
          Title();
         D2Print(title);
         while(GetAsyncKeyState(VK_F4))
         {SleepEx(100, true);}
    }
//play/pause
    if(GetAsyncKeyState(VK_F1))
    {
        SendMessage(hwndWinamp,WM_COMMAND,40046,0);
        while(GetAsyncKeyState(VK_F2))
         {SleepEx(200, true);}

    }
//next song
        if(GetAsyncKeyState(VK_F2))
    {
        SendMessage(hwndWinamp,WM_COMMAND,40048,0);
        Title();
         D2Print(title);
                  while(GetAsyncKeyState(VK_F2))
         {SleepEx(100, true);}

    }
//prev. song
        if(GetAsyncKeyState(VK_F3))
    {
        SendMessage(hwndWinamp,WM_COMMAND,40044,0);
           Title();
         D2Print(title);
               while(GetAsyncKeyState(VK_F3))
         {SleepEx(100, true);}


    }


    }
}

extern"C"
BOOL WINAPI DllMain(HINSTANCE hInstance,DWORD dwReason, LPVOID lpvReserved) {
   switch (dwReason) {
      case DLL_PROCESS_ATTACH: {

     CreateThread(0, 0, (LPTHREAD_START_ROUTINE) MyThread, 0, 0, 0);
                         }



    case DLL_PROCESS_DETACH: {

        }


                         }



                         return true;


}