Thread: Will this Work?

Results 1 to 15 of 15
  1. #1
    xxxPROFINITYxxx's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Kansas
    Posts
    62
    Reputation
    14
    Thanks
    2
    My Mood
    In Love

    Cool Will this Work?

    Here is Hybrid Base I. Will it work for Combat Arms?
    cMenu.h
    Code:
    #pragma once
    #define MC_ITEMY(index)  (Y+(index*I_SPC)+T_SPC+5)
    #define MC_ITEMY1(index) (Y+(index*I_SPC)+T_SPC+(FS_SPC*1)+10)
    #define MC_ITEMY2(index) (Y+(index*I_SPC)+T_SPC+(FS_SPC*2)+15)
    #define MC_ITEMY3(index) (Y+(index*I_SPC)+T_SPC+(FS_SPC*3)+20)
    //____________________Mousefix prevents bugs____________________________\\
    #define mousefix_L  if(GetAsyncKeyState(VK_LBUTTON)){GetAsyncKeyState(VK_RBUTTON);}
    #define mousefix_R  if(GetAsyncKeyState(VK_RBUTTON)){GetAsyncKeyState(VK_LBUTTON);}
    //____________________Define Colors here____________________________\\
    #define C_OFF  D3DCOLOR_ARGB( 255, 200, 200, 200 )
    #define C_OFF2  D3DCOLOR_ARGB( 255, 255,   0,   0 )
    #define C_ON  D3DCOLOR_ARGB( 255, 255, 255, 255 )
    #define C_ON2  D3DCOLOR_ARGB( 255,   0, 255,   0 )
    #define C_CAT  D3DCOLOR_ARGB( 250, 255,   0,  40 )
    #define C_CURBOX D3DCOLOR_ARGB( 140, 120,  60,  55 )
    #define C_TITLE  D3DCOLOR_ARGB( 250, 255,   0,  40 )
    #define C_Menu  D3DCOLOR_ARGB(  90,   0,   0,   0 )
    #define C_Border D3DCOLOR_ARGB( 190,  60,   0,   0 )
    //____________________Menu Class____________________________\\
    class cMenu{
    public:
     D3DCOLOR Pixelscan;
     POINT mpos;
     CD3DFont *cFont;
     char dllpath[255];
     bool
      FontCreated,
      firstInit
     ;
     void  InitalizeFont(LPDIRECT3DDEVICE9 pDevice);
     void  PostReset(LPDIRECT3DDEVICE9 pDevice);
     void  PreReset(void);
     char* GetFile(char *file);
     bool  MouseIsOver(int x, int y, int w, int h);
     void  GetCurrentPixelColor(LPDIRECT3DDEVICE9 pDevice, int x, int y);
     void  DrawBox(LPDIRECT3DDEVICE9 pDevice, int x, int y, int w, int h, D3DCOLOR Color);
     void  DrawBorder(LPDIRECT3DDEVICE9 device, int x, int y, int w, int h, int s, DWORD Color);
     void  Mouse(int x, int y, LPDIRECT3DDEVICE9 pDevice );
     void  CreateGUI(LPDIRECT3DDEVICE9 pDevice);
    private:
     //Privat Members
      int
      NO,
      X,Y,
      Current,
      Width,
      I_OFS,S_OFS,G_OFS,
      I_SPC,T_SPC,FS_SPC,FB_SPC
     ;
     bool
      Show,
      Init
     ;
     struct sitem
     {
      char title[50];
      char state[50];
      int  type;
      int  max;
      int  no;
      int  *val;
     }
     items[50];
     enum I_TYPES
     {
      T_TEXT = 0,
      T_ITEM = 1,
      T_CAT  = 2
     };
     void  InitializeMenu();
     void  Header(LPDIRECT3DDEVICE9 pDevice);
     void  MenuBG(LPDIRECT3DDEVICE9 pDevice);
     void  SL(LPDIRECT3DDEVICE9 pDevice);
     void  Date_Time(LPDIRECT3DDEVICE9 pDevice);
     void  Winamp_Remote(LPDIRECT3DDEVICE9 pDevice);
     void  Winamp_StatusBar(LPDIRECT3DDEVICE9 pDevice);
     void  Side_Boxes(LPDIRECT3DDEVICE9 pDevice);
     void  TrackIndex(LPDIRECT3DDEVICE9 pDevice);
     void  InitializeGUI(LPDIRECT3DDEVICE9 pDevice);
     void  Save(char* szSection, char* szKey, int iValue,LPCSTR file);
     int   Load(char* szSection, char* szKey, int iDefaultValue,LPCSTR file);
     void  additem(char *title, char *states,int type, int *var, int show, int when);
     void  Group(char *title, char *states,int *var);
     void  Item(char *title, char *states,int *var,int show,int when);
     void  Text(char *title, char *states);
     int   nofields(char *str);
     void  getfield(char *str,char *dst,int no);
    };
    extern cMenu Menu;
    //____________________Item struct____________________________\\
    struct Items
    {
     int
      stamina,
      chams,
      text,
      save,
      load
      ;
    };
    extern Items item;
    //____________________Group struct____________________________\\
    struct Groups
    {
     int 
      Player,
      D3D,
      Menu
     ;
    };
    cMenu.cpp
    Code:
    #include "D3D Base.h"
    #include "cMenu.h"
    #include "cWinamp.h"
    #include <windows.h>
    #include <time.h>
    #include <iostream>
    #include "stdio.h"
    #pragma warning(disable: 4101 4244 4996 4018)
    
    Items item;
    Groups group;
    cWinamp Winamp;
    void cMenu::InitalizeFont(LPDIRECT3DDEVICE9 pDevice)
    {
        Menu.cFont = new CD3DFont("Tahoma", 7, D3DFONT_BOLD);
        Menu.cFont->InitDeviceObjects(pDevice);
        Menu.cFont->RestoreDeviceObjects();
        FontCreated = true;
        firstInit = true;
    } 
    void cMenu::PostReset(LPDIRECT3DDEVICE9 pDevice)
    {
        if(Menu.cFont == NULL)
        {
            Menu.cFont = new CD3DFont("Tahoma", 7, D3DFONT_BOLD);
            Menu.cFont->InitDeviceObjects(pDevice);
            Menu.cFont->RestoreDeviceObjects();
            FontCreated = true;
        }
    }
    void cMenu::PreReset( void )
    {
        if(Menu.cFont)
        {
            Menu.cFont->InvalidateDeviceObjects();
            Menu.cFont->DeleteDeviceObjects();
            Menu.cFont = NULL;
            FontCreated = false;
        }
    }
    char* cMenu::GetFile(char *file)
    {
     static char path[320];
     for(int i= 0;i<strlen(path);i++)
      path[i]=0;
     strcpy(path, Menu.dllpath);
     strcat(path, file);
     return path;
    }
    bool cMenu::MouseIsOver(int x, int y, int w, int h)
    { 
        bool bover; 
        if(Menu.mpos.x >= x && Menu.mpos.x <= x + w && Menu.mpos.y >= y && Menu.mpos.y <= y + h)
     { 
      bover = true; 
     }else{ 
      bover = false; 
     } 
        return bover;
    }
    void cMenu::InitializeMenu()
    {
     if(!Init){
      X=15;//X Start of the Menu
      Y=40;//Y Start of the Menu
      Width=180;//Dont change this
      I_OFS=15;//Item space from X
      G_OFS=5;//Group space from X
      S_OFS=(Width/2)+40;//State space from X
      T_SPC=15;//Titel Box
      FS_SPC=15;//Small Footer
      FB_SPC=30;//Big Footer
      I_SPC=15;//Size of each Menuitem
      Show=false;
      Init=true;
     }
    }
    void cMenu::GetCurrentPixelColor(LPDIRECT3DDEVICE9 pDevice, int x, int y)
    {
     //Try yourself ;)
    }
    //Box with Primitives
    void cMenu::DrawBox(LPDIRECT3DDEVICE9 pDevice, int x, int y, int w, int h, D3DCOLOR Color)
    {
     struct Vertex 
     {
      float x,y,z,ht;
      DWORD Color;
     }
     
     V[4] = 
     {
      {(float)x,(float)(y+h), 0.0f, 0.0f, Color},
      {(float)x,(float)y, 0.0f, 0.0f, Color},
      {(float)(x+w),(float)(y+h), 0.0f, 0.0f, Color},
      {(float)(x+w),(float)y, 0.0f, 0.0f, Color}
     };
     pDevice->SetTexture(0, NULL);
     pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,true);
     pDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
     pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,V,sizeof(Vertex));
    }
    void cMenu::DrawBorder(LPDIRECT3DDEVICE9 device, int x, int y, int w, int h, int s, DWORD Color)
    {
        DrawBox(device, x, y-1, w, s, Color );
        DrawBox(device, x-1, y, s, h, Color );
        DrawBox(device, (x+w), y, s, h, Color );
        DrawBox(device, x, (y+h), w, s, Color );
    }
    //Credzis
    void cMenu::Mouse(int x, int y, LPDIRECT3DDEVICE9 pDevice)
    {
        #ifndef OUTLINE
        #define OUTLINE D3DCOLOR_RGBA(3, 6, 26, 215)
        #endif
        DrawBox(pDevice, x + 1,  y, 1, 17, OUTLINE);
        for(int i = 0; i < 11; i++)
        DrawBox(pDevice, x + 2 + i, y + 1 + i, 1, 1, OUTLINE);
        DrawBox(pDevice, x + 8,  y + 12, 5, 1, OUTLINE);
        DrawBox(pDevice, x + 8,  y + 13, 1, 1, OUTLINE);
        DrawBox(pDevice, x + 9,  y + 14, 1, 2, OUTLINE);
     DrawBox(pDevice, x + 10,  y + 16, 1, 2, OUTLINE);
        DrawBox(pDevice, x + 8,  y + 18, 2, 1, OUTLINE);
        DrawBox(pDevice, x + 7,  y + 16, 1, 2, OUTLINE);
        DrawBox(pDevice, x + 6,  y + 14, 1, 2, OUTLINE);
        DrawBox(pDevice, x + 5,  y + 13, 1, 1, OUTLINE);
        DrawBox(pDevice, x + 4,  y + 14, 1, 1, OUTLINE);
        DrawBox(pDevice, x + 3,  y + 15, 1, 1, OUTLINE);
        DrawBox(pDevice, x + 2,  y + 16, 1, 1, OUTLINE);
        for(int i = 0; i < 4; i++)
        DrawBox(pDevice, x + 2 + i, y + 2 + i, 1, 14 - (i * 2), D3DCOLOR_RGBA(255 - (i * 4), 255 - (i * 4), 255 - (i * 4), 255));
        DrawBox(pDevice, x + 6,    y + 6, 1, 8,  D3DCOLOR_RGBA(235, 235, 235, 255));
        DrawBox(pDevice, x + 7,    y + 7, 1, 9,  D3DCOLOR_RGBA(231, 231, 231, 255));
        for(int i = 0; i < 4; i++)
        DrawBox(pDevice, x + 8 + i, y + 8 + i, 1, 4 - i,  D3DCOLOR_RGBA(227 - (i * 4), 227 - (i * 4), 227 - (i * 4), 255));
        DrawBox(pDevice, x + 8,    y + 14, 1, 4,  D3DCOLOR_RGBA(207, 207, 207, 255));
        DrawBox(pDevice, x + 9,    y + 16, 1, 2,  D3DCOLOR_RGBA(203, 203, 203, 255));
    }
    //Header of the Menu
    void cMenu::Header(LPDIRECT3DDEVICE9 pDevice)
    {
     DrawBox(pDevice,X,Y,Width,T_SPC,C_Menu);
     DrawBorder(pDevice,X,Y,Width,T_SPC,1,C_Border);
     cFont->DrawText((X+(X+Width)/2),Y+2,C_TITLE,"Hybrid GUI",D3DFONT_CENTER|D3DFONT_SHADOW);
    }
    //The Background of the Menu; Main Box
    void cMenu::MenuBG(LPDIRECT3DDEVICE9 pDevice)
    {
     DrawBox(pDevice,X,(Y+T_SPC+5),Width,(NO*I_SPC),C_Menu);
     DrawBorder(pDevice,X,(Y+T_SPC+5),Width,(NO*I_SPC),1,C_Border);
    }
    //Save and Load Box
    void cMenu::SL(LPDIRECT3DDEVICE9 pDevice)
    {
     //Save
     DrawBox(pDevice,X,MC_ITEMY(NO)+5,(Width)/2,(FS_SPC),C_Menu);
     DrawBorder(pDevice,X,MC_ITEMY(NO)+5,(Width)/2,(FS_SPC),1,C_Border);
     if(MouseIsOver(X,MC_ITEMY(NO)+5,(Width)/2,(FS_SPC)))
     {
      DrawBox(pDevice,X,MC_ITEMY(NO)+5,(Width)/2,(FS_SPC),C_CURBOX);
      if(GetAsyncKeyState(VK_LBUTTON) &1){item.save=1;}else{mousefix_L}
     }
     cFont->DrawText(X+(Width)/4,MC_ITEMY(NO)+(FS_SPC)/2,C_TITLE,"Save",D3DFONT_CENTER|D3DFONT_SHADOW);
     //Load
     DrawBox(pDevice,X+(Width)/2,MC_ITEMY(NO)+5,(Width)/2,(FS_SPC),C_Menu);
     DrawBorder(pDevice,X+(Width)/2,MC_ITEMY(NO)+5,(Width)/2,(FS_SPC),1,C_Border);
     if(MouseIsOver(X+(Width)/2,MC_ITEMY(NO)+5,(Width)/2,(FS_SPC)))
     {
      DrawBox(pDevice,X+(Width)/2,MC_ITEMY(NO)+5,(Width)/2,(FS_SPC),C_CURBOX);
      if(GetAsyncKeyState(VK_LBUTTON) &1){item.load=1;}else{mousefix_L}
     }
     cFont->DrawText(X+((Width)/4)*3,MC_ITEMY(NO)+(FS_SPC)/2,C_TITLE,"Load",D3DFONT_CENTER|D3DFONT_SHADOW);
    }
    //Date and Time Box
    void cMenu::Date_Time(LPDIRECT3DDEVICE9 pDevice)
    {
     struct tm * current_tm;
     time_t current_time;time (&current_time);
     current_tm = localtime (&current_time);
     char *month []={"January","February","March","April","Mai","June","July","August","September","October","November","December"};
     char *logbuf = new char[ 256 ];
     sprintf( logbuf, "%02dth %s %d [%02d:%02d:%02d]",current_tm->tm_mday,month[current_tm->tm_mon],current_tm->tm_year-100, current_tm->tm_hour, current_tm->tm_min, current_tm->tm_sec);
     DrawBox(pDevice,X,MC_ITEMY1(NO)+5,Width,(FS_SPC),C_Menu);
     DrawBorder(pDevice,X,MC_ITEMY1(NO)+5,Width,(FS_SPC),1,C_Border);
     cFont->DrawText(((X+(X+Width))/2),MC_ITEMY1(NO)+7,C_TITLE,logbuf,D3DFONT_CENTER|D3DFONT_SHADOW);
    }
    //Box with Winamp remote Buttons
    void cMenu::Winamp_Remote(LPDIRECT3DDEVICE9 pDevice)
    {
     //Background
     DrawBox(pDevice,X,MC_ITEMY2(NO)+5,Width,(FS_SPC),C_Menu);
     DrawBorder(pDevice,X,MC_ITEMY2(NO)+5,Width,(FS_SPC),1,C_Border);
     //Fast Rewind
     DrawBorder(pDevice,X,MC_ITEMY2(NO)+5,30,(FS_SPC),1,C_Border);
     if(MouseIsOver(X,MC_ITEMY2(NO)+5,30,(FS_SPC)))
     {
      DrawBox(pDevice,X,MC_ITEMY2(NO)+5,30,(FS_SPC),C_CURBOX);
      if(GetAsyncKeyState(VK_LBUTTON) &1)
      {
       Winamp.FastRewind();
      }else{mousefix_L}
     }
     cFont->DrawText(X+((Width/6)*1)-((Width/6)/2),MC_ITEMY2(NO)+7,C_TITLE,"<<",D3DFONT_CENTER|D3DFONT_SHADOW|D3DFONT_BOLD);
     
     //Previous Track
     DrawBorder(pDevice,X+30,MC_ITEMY2(NO)+5,30,(FS_SPC),1,C_Border);
     if(MouseIsOver(X+30,MC_ITEMY2(NO)+5,30,(FS_SPC)))
     {
      DrawBox(pDevice,X+30,MC_ITEMY2(NO)+5,30,(FS_SPC),C_CURBOX);
      if(GetAsyncKeyState(VK_LBUTTON) &1)
      {
       Winamp.Previous_Track();
      }else{mousefix_L}
     }
     cFont->DrawText(X+((Width/6)*2)-((Width/6)/2),MC_ITEMY2(NO)+7,C_TITLE,"<",D3DFONT_CENTER|D3DFONT_SHADOW|D3DFONT_BOLD);
     //Play
     DrawBorder(pDevice,X+60,MC_ITEMY2(NO)+5,30,(FS_SPC),1,C_Border);
     if(MouseIsOver(X+60,MC_ITEMY2(NO)+5,30,(FS_SPC)))
     {
      DrawBox(pDevice,X+60,MC_ITEMY2(NO)+5,30,(FS_SPC),C_CURBOX);
      if(GetAsyncKeyState(VK_LBUTTON) &1)
      {
       Winamp.Play();
      }else{mousefix_L}
     }
     cFont->DrawText(X+((Width/6)*3)-((Width/6)/2),MC_ITEMY2(NO)+7,C_TITLE,"|>",D3DFONT_CENTER|D3DFONT_SHADOW|D3DFONT_BOLD);
     //Pause
     DrawBorder(pDevice,X+90,MC_ITEMY2(NO)+5,30,(FS_SPC),1,C_Border);
     if(MouseIsOver(X+90,MC_ITEMY2(NO)+5,30,(FS_SPC)))
     {
      DrawBox(pDevice,X+90,MC_ITEMY2(NO)+5,30,(FS_SPC),C_CURBOX);
      if(GetAsyncKeyState(VK_LBUTTON) &1)
      {
       Winamp.Pause();
      }else{mousefix_L}
     }
     cFont->DrawText(X+((Width/6)*4)-((Width/6)/2),MC_ITEMY2(NO)+7,C_TITLE,"||",D3DFONT_CENTER|D3DFONT_SHADOW|D3DFONT_BOLD);
     //Next Track
     DrawBorder(pDevice,X+120,MC_ITEMY2(NO)+5,30,(FS_SPC),1,C_Border);
     if(MouseIsOver(X+120,MC_ITEMY2(NO)+5,30,(FS_SPC)))
     {
      DrawBox(pDevice,X+120,MC_ITEMY2(NO)+5,30,(FS_SPC),C_CURBOX);
      if(GetAsyncKeyState(VK_LBUTTON) &1)
      {
       Winamp.Next_Track();
      }else{mousefix_L}
     }
     cFont->DrawText(X+((Width/6)*5)-((Width/6)/2),MC_ITEMY2(NO)+7,C_TITLE,">",D3DFONT_CENTER|D3DFONT_SHADOW|D3DFONT_BOLD);
     //Fast Forward
     DrawBorder(pDevice,X+150,MC_ITEMY2(NO)+5,30,(FS_SPC),1,C_Border);
     if(MouseIsOver(X+150,MC_ITEMY2(NO)+5,30,(FS_SPC)))
     {
      DrawBox(pDevice,X+150,MC_ITEMY2(NO)+5,30,(FS_SPC),C_CURBOX);
      if(GetAsyncKeyState(VK_LBUTTON))
      {
       Winamp.FastForward();
      }else{mousefix_L}
     }
     cFont->DrawText(X+((Width/6)*6)-((Width/6)/2),MC_ITEMY2(NO)+7,C_TITLE,">>",D3DFONT_CENTER|D3DFONT_SHADOW|D3DFONT_BOLD);
    }
    //TrackStatus Bar
    void cMenu::Winamp_StatusBar( LPDIRECT3DDEVICE9 pDevice)
    {
     float Percent = Winamp.GetSongCompletedPercentage();
     float Status = ( Percent == 0 ) ? 0 : ( (Width-10) * Percent ) / 100;
     if(Percent > 100)Winamp.Next_Track();//Prevents Bugs
     //Menu Box
     DrawBox(pDevice,X,MC_ITEMY3(NO)+5,Width,(FS_SPC),C_Menu);
     DrawBorder(pDevice,X,MC_ITEMY3(NO)+5,Width,(FS_SPC),1,C_Border);
     //StatusBox
     DrawBox(pDevice,X+5,MC_ITEMY3(NO)+10,Width-10,(FS_SPC)-10,D3DCOLOR_ARGB(80,20,20,20));
     DrawBox(pDevice,X+5,MC_ITEMY3(NO)+10,(FLOAT)Status,(FS_SPC)-10,D3DCOLOR_ARGB(250,255,0,40));
     DrawBorder(pDevice,X+5,MC_ITEMY3(NO)+10,Width-10,(FS_SPC)-10,1,D3DCOLOR_ARGB(80,255,0,40));
     //TODO: Seek_Track_Position using mouseover
    }
    //Two lidl Boxes on the left and right side
    void cMenu::Side_Boxes(LPDIRECT3DDEVICE9 pDevice)
    {
     //Left
     DrawBox(pDevice,X-10,Y,5,(NO*I_SPC)+T_SPC+(FS_SPC*4)+(FB_SPC*0)+25,C_Menu);
     DrawBorder(pDevice,X-10,Y,5,(NO*I_SPC)+T_SPC+(FS_SPC*4)+(FB_SPC*0)+25,1,C_Border);
     //Right
     DrawBox(pDevice,X+Width+5,Y,5,(NO*I_SPC)+T_SPC+(FS_SPC*4)+(FB_SPC*0)+25,C_Menu);
     DrawBorder(pDevice,X+Width+5,Y,5,(NO*I_SPC)+T_SPC+(FS_SPC*4)+(FB_SPC*0)+25,1,C_Border);
    }
    //Current and Next Song
    void cMenu::TrackIndex(LPDIRECT3DDEVICE9 pDevice)
    {
     char *Track = new char[ 256 ];
     DrawBox(pDevice, 2, 7, 1, 10, D3DCOLOR_ARGB(255,255,0,0));
     DrawBox(pDevice, 2, 17, 10, 1, D3DCOLOR_ARGB(255,255,0,0));
        if( Winamp.IsProcessRunning() == false )
     {
      cFont->DrawText(5,5,C_TITLE,"Winamp is not running",DT_LEFT|D3DFONT_SHADOW);
     }
        else if( Winamp.GetNumberOfTracksOnPlaylist() == 0 )
     {
      cFont->DrawText(5,5,C_TITLE,"No Track to display",DT_LEFT|D3DFONT_SHADOW);
     }
     else
     {
      sprintf( Track, "Current Track: %s", Winamp.GetPlaylistTitleByIndex(Winamp.GetCurrentTrackIndex()).c_str());
      cFont->DrawText(5,5,C_TITLE,Track,DT_LEFT|D3DFONT_SHADOW);
      sprintf( Track, "Next Track: %s", Winamp.GetPlaylistTitleByIndex(Winamp.GetNextTrackIndex()).c_str());
      cFont->DrawText(5,20,C_TITLE,Track,DT_LEFT|D3DFONT_SHADOW);
      DrawBox(pDevice, 2, 22, 1, 10, D3DCOLOR_ARGB(255,255,0,0));
      DrawBox(pDevice, 2, 32, 10, 1, D3DCOLOR_ARGB(255,255,0,0));
     } 
    }
    //Initialize the GUI
    void cMenu::InitializeGUI(LPDIRECT3DDEVICE9 pDevice)
    {
     Header(pDevice);
     MenuBG(pDevice);
     SL(pDevice);
     Date_Time(pDevice);
     Winamp_Remote(pDevice);
     Winamp_StatusBar(pDevice);
     Side_Boxes(pDevice);
     TrackIndex(pDevice);
    }
    //Build the GUI
    void cMenu::CreateGUI(LPDIRECT3DDEVICE9 pDevice)
    {
     GetCursorPos(&mpos);//X and Y of the curser
     ScreenToClient(GetForegroundWindow(),&mpos);
     InitializeMenu();
     InitalizeFont(pDevice);
     if(GetAsyncKeyState(VK_INSERT)&1) Show=(!Show);
     if(Show){
      InitializeGUI(pDevice);
      NO=0;
      Group("Player Related","+|-",&group.Player);//This is the group
       Item("Want Stamina?","Nope ;)|Gimme!",&item.stamina,group.Player,1);//and this one member of this group
      Group("Direct3D Stuff","+|-",&group.D3D);//same
       Item("Chams0r the Enemies?","No|YEHA!",&item.chams,group.D3D,1);
    
      item.save=0;
      item.load=0;
      //Render the Menu
      for(int no=0; no<NO; no++)
      { 
       D3DCOLOR text;
       D3DCOLOR text2;
       text=(*(items[no].val)>0)?C_ON:C_OFF;
       text2=(*(items[no].val)>0)?C_ON2:C_OFF2;
       if(items[no].type==T_CAT)
        text=C_CAT;
       if(mpos.x>X && mpos.x<(X+Width) && mpos.y>MC_ITEMY(no) && mpos.y<MC_ITEMY(no)+I_SPC)
        DrawBox(pDevice,X+1,MC_ITEMY(no),Width-1,I_SPC,C_CURBOX);//Lil Box on every Item
       if(items[no].type==T_CAT)
        cFont->DrawText(X+G_OFS,MC_ITEMY(no)+2,text,items[no].title,D3DFONT_SHADOW);
       else 
        cFont->DrawText(X+I_OFS,MC_ITEMY(no)+2,text,items[no].title,D3DFONT_SHADOW);
       cFont->DrawText(X+S_OFS,MC_ITEMY(no)+2,text2,items[no].state,DT_LEFT|D3DFONT_SHADOW);
       if(items[no].type!=T_CAT)
        DrawBox(pDevice, X+5, MC_ITEMY(no)+5, 5, 5, text2);
      }
      int mno=999;
      if(MouseIsOver(X, Y, Width, MC_ITEMY(NO)))
       mno = ((mpos.y-T_SPC)>Y)?((mpos.y - Y - T_SPC - (T_SPC/2)) / I_SPC):(999);
      //If Right Mousebutton is klicked once..
      if(mno!=999 && GetAsyncKeyState(VK_RBUTTON)&1 && (*items[mno].val)>0)
      {
       (*items[mno].val)-=1;
      }else{mousefix_R}
      //if Left Mousebutton is klicked once..
      if(mno!=999 && GetAsyncKeyState(VK_LBUTTON)&1 && (*items[mno].val)<(items[mno].max-1))
      {
       (*items[mno].val)+=1;
      }else{mousefix_L}
      if(Current>NO)Current=NO-1;
      //Draw a Curser; Full credits to Credzis
      Mouse(mpos.x, mpos.y, pDevice);
     }
    }
    //____________________Some cool stuff from Pheno____________________________\\
    void cMenu::Save(char* szSection, char* szKey, int iValue,LPCSTR file)
    {
     char szValue[255];
     sprintf(szValue, "%d", iValue);
     WritePrivateProfileString(szSection,  szKey, szValue, file); 
    }
    int cMenu::Load(char* szSection, char* szKey, int iDefaultValue,LPCSTR file)
    {
     int iResult = GetPrivateProfileInt(szSection,  szKey, iDefaultValue, file); 
     return iResult;
    }
    void cMenu::additem(char *title, char *states,int type, int *var, int show, int when)
    {
     if(show==when)
     {
      strcpy(items[NO].title,title);
      getfield(states,items[NO].state,*var+1);
      items[NO].type=type;
      items[NO].max=nofields(states);
      items[NO].val=var;
      NO++;
     }
     if(type!=T_TEXT)
     {
      if (item.load)
       *var = Load("Menu", title, *var,GetFile("penis"));
      if (item.save)
       Save("Menu", title, *var,GetFile("bla"));// Not nessesary cause we save it in Registery ;D
     }
    }
    void cMenu::Group(char *title, char *states,int *var)
    {
     additem(title,states,T_CAT,var,0,0);
    }
    void cMenu::Item(char *title, char *states,int *var,int show,int when)
    {
     additem(title,states,T_ITEM,var,show,when);
    }
    void cMenu::Text(char *title, char *states)
    { 
     additem(title,states,T_TEXT,&item.text,1,1);
    }
    int cMenu::nofields(char *str)
    {
     char *ptr;
     int  no;
     for(no=1; (ptr=strchr(str,(char)'|'))!=NULL; no++)str=ptr+1;
     return no;
    }
    void cMenu::getfield(char *str,char *dst,int no)
    {
     char *ptr;  
     int  i;
     for(i=1; (ptr=strchr(str,(char)'|'))!=NULL ; i++) 
     {
      if(i==no) break;
      str=ptr+1;
     }
     if(ptr)
     {
      i=(int)(ptr-str);
      strncpy(dst,str,i);
      dst[i]=0;
     }
     else
      strcpy(dst,str);
    }
    cWinamp.h
    Code:
    #ifndef __CWINAMP_H__
    #define __CWINAMP_H__
    #pragma warning(disable: 4530)
    #include <string>
    #include <windows.h>
    #include "wa_ipc.h"
    #include "License.h"
    //defines
    #define WINAMP_BUTTON_REPEAT    40022
    #define WINAMP_BUTTON_SHUFFLE    40023
    #define MAX_SONG_LEN            765
    typedef struct
    {
        char *szCurrentHours;
        char *szCurrentMinutes;
        char *szCurrentSeconds;
        char *sz******ours;
        char *szTotalMinutes;
        char *szTotalSeconds;
    } tracktime_s;
    typedef enum
    {
        WINAMP_STOP = 0,
        WINAMP_PLAY = 1,
        WINAMP_PAUSE = 3,
        WINAMP_UNKNOWN = -1
    } playstatus_s;
    class cWinamp
    {
    public:
        //-------------------------------------------------
        //class related
        cWinamp( );
        ~cWinamp( );
        void        Cleanup( void );
        bool        IsProcessRunning( void );
        bool        ExecuteWinamp( const char *szPath );
        bool        TerminateWinampProcess( void );
        //-------------------------------------------------
        //information functions
        int            GetTrackPlayed( void );
        int            GetTrackLength( void );
        int            GetCurrentVolume( void ){ return Request_Command( IPC_CB_MISC_VOLUME, IPC_CB_MISC ); }
        bool        IsRepeating( void ){ return ( ( Request_Command( 0, IPC_GET_REPEAT ) == 0 ) ? false : true ); }
        bool        IsShuffling( void ){ return ( ( Request_Command( 0, IPC_GET_SHUFFLE ) == 0 ) ? false : true ); }
        int            GetSongCompletedPercentage( void );
        int            GetCurrentTrackIndex( void );
        int            GetNextTrackIndex( void );
        int            GetNumberOfTracksOnPlaylist( void );
        int            GetPlaylistPosition( void );
        std::string GetPlaylistTitleByIndex( int index );
        tracktime_s GetTrackTimeInformation( void );
        playstatus_s GetPlayingStatus( void );
        char*        GetPlaystatusString( playstatus_s status );
        //-------------------------------------------------
        //control functions
        void        Play( void ){ Send_Command( WINAMP_BUTTON2 ); }
        void        Pause( void ){ Send_Command( WINAMP_BUTTON3 ); }
        void        Stop( void ){ Send_Command( WINAMP_BUTTON4 ); }
        void        Next_Track( void ){ Send_Command( WINAMP_BUTTON5 ); }
        void        Previous_Track( void ){ Send_Command( WINAMP_BUTTON1 ); }
        void        Repeat_Toggle( void ){ Send_Command( WINAMP_BUTTON_REPEAT ); }
        void        Shuffle_Toggle( void ){ Send_Command( WINAMP_BUTTON_SHUFFLE ); }
        void        Seek_Track_Position( int m_iPosition ){ Request_Command( m_iPosition, IPC_JUMPTOTIME ); }
        void        SetVolume( int m_iVolume ){ Request_Command( m_iVolume, IPC_SETVOLUME ); }
        void        IncreaseVolume( void ){ Send_Command( WINAMP_VOLUMEUP ); }
        void        DecreaseVolume( void ){ Send_Command( WINAMP_VOLUMEDOWN ); }
        void        Goto_Track_Begin( void ){ Send_Command( WINAMP_BUTTON1_CTRL ); }
        void        Goto_Track_End( void ){ Send_Command( WINAMP_BUTTON5_CTRL ); }
        void        Goto_TrackByIndex( int index ){ Request_Command( index - 1,IPC_SETPLAYLISTPOS ); }
        void        FastForward( void ){ Send_Command( WINAMP_FFWD5S ); }
        void        FastRewind( void ){ Send_Command( WINAMP_REW5S ); }
        void        LoadPlaylist( char *m_szDirectory, char *m_szFile );
        
        //-------------------------------------------------
        //functionality
        int            Request_Command( int m_iData, int m_iCmd );
        void        Send_Command( int m_iCmd );
    private:
            HWND    m_hWindow;
            DWORD   m_dwProcessId;
            HANDLE  m_hProcess;
    };
    extern cWinamp Winamp;
    #endif
    cWinamp.cpp
    Code:
    include <windows.h>
    #include <shellapi.h>
    #include "cWinamp.h"
    #include "wa_ipc.h"
    //_________________Credits: ****** and nullsoft___________________
    //int/char conversion
    #pragma warning( disable : 4312 )
    cWinamp GWinamp;
    char *GSZTimeStrings[] = 
    {
        "00", "01", "02", "03", "04", "05", "06", "07", "08", "09",
        "10", "11", "12", "13", "14", "15", "16", "17", "18", "19",
        "20", "21", "22", "23", "24", "25", "26", "27", "28", "29",
        "30", "31", "32", "33", "34", "35", "36", "37", "38", "39",
        "40", "41", "42", "43", "44", "45", "46", "47", "48", "49",
        "50", "51", "52", "53", "54", "55", "56", "57", "58", "59"
    };
    //======================================================================================
    cWinamp::cWinamp( )
    {
        Cleanup( );
    }
    cWinamp::~cWinamp( )
    {
        if( m_hProcess )
            CloseHandle( m_hProcess );
        Cleanup( );
    }
    //======================================================================================
    void cWinamp::Cleanup( void )
    {
        ZeroMemory( &m_hProcess,    sizeof( HANDLE ) );
        ZeroMemory( &m_hWindow,        sizeof( HWND ) );
        ZeroMemory( &m_dwProcessId, sizeof( DWORD ) );
    }
    bool cWinamp::IsProcessRunning( void )
    {
        if( m_hWindow || m_hProcess )
            return true;
        m_hWindow = FindWindowA( "Winamp v1.x", 0 );
        if( m_hWindow )
        {
            GetWindowThreadProcessId( m_hWindow, &m_dwProcessId );
            if( m_dwProcessId )
            {
                m_hProcess = OpenProcess( PROCESS_ALL_ACCESS, false, m_dwProcessId );
                if( m_hProcess )
                {
                    return true;
                }
            }
        }
        return false;
    }
    void cWinamp::Send_Command( int m_iCmd )
    {
        if( !IsProcessRunning( ) )
            return;
        PostMessage( m_hWindow, WM_COMMAND, m_iCmd, 0 );
    }
    int cWinamp::Request_Command( int m_iData, int m_iCmd )
    {
        if( !IsProcessRunning( ) )
            return -1;
        return ( int )SendMessage( m_hWindow, WM_WA_IPC, m_iData, m_iCmd );
    }
    bool cWinamp::ExecuteWinamp( const char *szPath )
    {
        if( !IsProcessRunning( ) )
            return false;
        BOOL m_bSuccess = FALSE;
        STARTUPINFOA SI;
        PROCESS_INFORMATION PI;
        ZeroMemory( &SI, sizeof( STARTUPINFOA ) );
        ZeroMemory( &PI, sizeof( PROCESS_INFORMATION ) );
        SI.cb = sizeof( STARTUPINFOA );
        m_bSuccess = CreateProcessA( szPath, 0, 0, 0, false, 0, 0, 0, &SI, &PI );
        if( m_bSuccess == TRUE )
        {
            m_dwProcessId = PI.dwProcessId;
            return true;
        }
        return false;
    }
    bool cWinamp::TerminateWinampProcess( void )
    {
        if( !IsProcessRunning( ) )
            return false;
        return ( bool )( TerminateProcess( m_hProcess, 0 ) ? true : false );
    }
    //======================================================================================
    int cWinamp::GetTrackPlayed( void )
    {
        if( !IsProcessRunning( ) )
            return 0;
        //seconds
        int m_iMessage = Request_Command( 0, IPC_GETOUTPUTTIME );
        return ( m_iMessage / 1000 );
    }
    int cWinamp::GetTrackLength( void )
    {
        if( !IsProcessRunning( ) )
            return 0;
        //seconds
        return Request_Command( 1, IPC_GETOUTPUTTIME );
    }
    int cWinamp::GetCurrentTrackIndex( void )
    {
        return Request_Command( 0, IPC_GETLISTPOS );
    }
    int cWinamp::GetNextTrackIndex( void )
    {
        if( !IsProcessRunning( ) )
            return 0;
        int m_iAllTracks = GetNumberOfTracksOnPlaylist( );
        if( m_iAllTracks == 0 )
            return 0;
        int m_iCurrent_Index = GetCurrentTrackIndex( );
        if( m_iCurrent_Index >= m_iAllTracks )
        {
            m_iCurrent_Index = 0;
            goto return_index;
        }
        m_iCurrent_Index++;
    return_index:
        return m_iCurrent_Index;
    }
    int cWinamp::GetSongCompletedPercentage( void )
    {
        if( !IsProcessRunning( ) )
            return 0;
        float m_iTrackPlayed = ( float )GetTrackPlayed( );
        float m_iTotalTrack = ( float )GetTrackLength( );
        if( m_iTotalTrack == 0 || m_iTrackPlayed == 0 )
            return 0;
        float m_fTrackFraction = ( m_iTrackPlayed / m_iTotalTrack );
        m_fTrackFraction *= 100.0f;
        return ( int )( m_fTrackFraction );
    }
    int cWinamp::GetNumberOfTracksOnPlaylist( void )
    {
        if( !IsProcessRunning( ) )
            return 0;
        return ( Request_Command( 0, IPC_GETLISTLENGTH ) - 1 );
    }
    int cWinamp::GetPlaylistPosition( void )
    {
        if( !IsProcessRunning( ) )
            return 0;
        return Request_Command( 0, IPC_GETLISTPOS );
    }
    std::string cWinamp::GetPlaylistTitleByIndex( int index )
    {
        if( !IsProcessRunning( ) )
            return 0;
        DWORD m_dwReadBytes = 0;
        char m_szTrackName[ MAX_SONG_LEN ] = { '\0' };
        char *m_szName = ( char* )Request_Command( index, IPC_GETPLAYLISTTITLE );
        ReadProcessMemory( m_hProcess, m_szName, m_szTrackName, MAX_SONG_LEN, &m_dwReadBytes );
        return ( std::string )m_szTrackName;
    }
    tracktime_s cWinamp::GetTrackTimeInformation( void )
    {
        tracktime_s tmp;
        if( IsProcessRunning( ) )
        {
            int seconds = ( int )( ( float )Request_Command( 0, IPC_GETOUTPUTTIME ) * 0.001f );
            int hours = seconds / 3600;
            int minutes = ( seconds - hours * 3600 ) / 60;
            seconds = seconds % 60;
            tmp.szCurrentHours = GSZTimeStrings[ hours ];
            tmp.szCurrentMinutes = GSZTimeStrings[ minutes ];
            tmp.szCurrentSeconds = GSZTimeStrings[ seconds ];
            seconds = Request_Command( 1, IPC_GETOUTPUTTIME );
            hours = seconds / 3600;
            minutes = ( seconds - hours * 3600 ) / 60;
            seconds = seconds % 60;
            tmp.sz******ours = GSZTimeStrings[ hours ];
            tmp.szTotalMinutes = GSZTimeStrings[ minutes ];
            tmp.szTotalSeconds = GSZTimeStrings[ seconds ];
        }
        return tmp;
    }
    void cWinamp::LoadPlaylist( char *m_szDirectory, char *m_szFile )
    {
        ShellExecuteA( NULL, NULL, m_szFile, NULL, m_szDirectory, SW_SHOWNA );
    }
    playstatus_s cWinamp::GetPlayingStatus( void )
    {
        if( !IsProcessRunning( ) )
        {
            goto return_unknown;
        }
        return ( playstatus_s )Request_Command( 0, IPC_ISPLAYING );
    return_unknown:
        return WINAMP_UNKNOWN;
    }
    char *cWinamp::GetPlaystatusString( playstatus_s status )
    {
        if( IsProcessRunning( ) )
        {
            switch( status )
            {
            case WINAMP_STOP:return "Stopped";
            case WINAMP_PLAY:return "Playing";
            case WINAMP_PAUSE:return "Paused";
            }
        }
        return "Winamp inactive";
    }
    D3D Base.h
    Code:
    #pragma once
    #include <windows.h>
    #include <d3d9.h>
    #include "d3dfont9.h"
    #include "License.h"
    #pragma comment (lib, "d3d9.lib")
    
    #define RESET  16
    #define BEGINSCENE  41
    #define ENDSCENE 42
    #define DRAWINDEXEDPRIMITIVE 82
    #define SETRENDERSTATE 50
    
    typedef HRESULT (WINAPI* oEndScene)             ( LPDIRECT3DDEVICE9 pDevice);
    typedef HRESULT (WINAPI* oBeginScene)   ( LPDIRECT3DDEVICE9 pDevice);
    typedef HRESULT (WINAPI* oReset)                ( LPDIRECT3DDEVICE9 pDevice,D3DPRESENT_PARAMETERS* pPresentationParameters);
    typedef HRESULT (WINAPI* oDrawIndexedPrimitive) ( LPDIRECT3DDEVICE9 pDevice,D3DPRIMITIVETYPE Type,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount );
    typedef HRESULT (WINAPI* oSetRenderState )  ( LPDIRECT3DDEVICE9 pDevice, D3DRENDERSTATETYPE State, DWORD Value, UINT NumVertices, UINT startIndex, UINT primCount, UINT m_Stride );
    D3D Base.cpp
    Code:
    #include "d3dfont9.cpp"
    #include "d3d9types.h"
    #include "D3D Base.h"
    #include "cMenu.h"
    cMenu Menu;
    oReset pReset;
    oEndScene pEndScene;
    oDrawIndexedPrimitive pDrawIndexedPrimitive;
    UINT m_Stride; 
    HRESULT WINAPI Reset ( LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters )
    {
     if(Menu.FontCreated && Menu.firstInit)
      Menu.PreReset();
     if(!Menu.FontCreated && Menu.firstInit)
      Menu.PostReset(pDevice);
     return pReset( pDevice, pPresentationParameters );
    }
    HRESULT WINAPI EndScene (LPDIRECT3DDEVICE9 pDevice)
    {
     Menu.CreateGUI(pDevice);//Call the Menu
     return pEndScene(pDevice);
    }
    HRESULT WINAPI DrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount)
    {
     //Chams or w.e here
     return pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
    }
    bool bCompare(const BYTE* pData, const BYTE* bMask, const char* szMask)
    {
     for(;*szMask;++szMask,++pData,++bMask)
     {
      if(*szMask=='x' && *pData!=*bMask)   
       return 0;
     }
     return (*szMask) == NULL;
    }
    DWORD FindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char * szMask)
    {
     for(DWORD i=0; i<dwLen; i++)
      if (bCompare((BYTE*)(dwAddress+i),bMask,szMask))  return (DWORD)(dwAddress+i);
     return 0;
    }
    void *DetourCreate(BYTE *src, const BYTE *dst, const int len)
    {
     BYTE *jmp = (BYTE*)malloc(len+5);
     DWORD dwBack;
     VirtualProtect(src, len, PAGE_EXECUTE_READWRITE, &dwBack);
     memcpy(jmp, src, len); 
     jmp += len;
     jmp[0] = 0xE9;
     *(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;
     src[0] = 0xE9;
     *(DWORD*)(src+1) = (DWORD)(dst - src) - 5;
     for (int i=5; i<len; i++)  src[i]=0x90;
     VirtualProtect(src, len, dwBack, &dwBack);
     return (jmp-len);
    }
    int Initialize(void)
    {
     DWORD  hD3D, adr, *vtbl;
     hD3D=0;
     do {
      hD3D = (DWORD)GetModuleHandle("d3d9.dll");
      Sleep(10);
     } while(!hD3D);
     adr = FindPattern(hD3D, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx");
     if (adr) {
      memcpy(&vtbl,(void *)(adr+2),4);
      pReset   = (oReset) DetourCreate((PBYTE)vtbl[RESET]   , (PBYTE)Reset   ,5);
      pEndScene = (oEndScene) DetourCreate((PBYTE)vtbl[ENDSCENE], (PBYTE)EndScene,5);
      pDrawIndexedPrimitive = (oDrawIndexedPrimitive) DetourCreate((PBYTE)vtbl[DRAWINDEXEDPRIMITIVE], (PBYTE)DrawIndexedPrimitive,5);
      }
     return 0;
    }
    BOOL WINAPI DllMain(HMODULE hDll, DWORD dwReason, LPVOID lpReserved)
    {
     switch(dwReason)
     {
      case DLL_PROCESS_ATTACH:
       CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)Initialize, NULL, NULL, NULL);
       break;
      case DLL_PROCESS_DETACH:
       break;
     }
     return TRUE;
    }
    d3dfont9.h
    Code:
    //-----------------------------------------------------------------------------
    // File: D3DFont.h
    // Desc: Texture-based font class
    // Copyright (c)  Microsoft Corporation. All rights reserved.
    //-----------------------------------------------------------------------------
    #ifndef D3DFONT_H
    #define D3DFONT_H
    #include <tchar.h>
    #include <D3D9.h>
    
    
    // Font creation flags
    #define D3DFONT_BOLD        0x0001
    #define D3DFONT_ITALIC      0x0002
    #define D3DFONT_ZENABLE     0x0004
    
    // Font rendering flags
    #define D3DFONT_CENTER      0x0001
    #define D3DFONT_TWOSIDED    0x0002
    #define D3DFONT_FILTERED    0x0004
    #define D3DFONT_RIGHT       0x0008			// non standard feature
    #define D3DFONT_SHADOW      0x0010			// non standard feature
    
    
    
    //-----------------------------------------------------------------------------
    // Name: class CD3DFont
    // Desc: Texture-based font class for doing text in a 3D scene.
    //-----------------------------------------------------------------------------
    class CD3DFont
    {
        TCHAR   m_strFontName[80];            // Font properties
        DWORD   m_dwFontHeight;
        DWORD   m_dwFontFlags;
    
        LPDIRECT3DDEVICE9       m_pd3dDevice; // A D3DDevice used for rendering
        LPDIRECT3DTEXTURE9      m_pTexture;   // The d3d texture for this font
        LPDIRECT3DVERTEXBUFFER9 m_pVB;        // VertexBuffer for rendering text
        DWORD   m_dwTexWidth;                 // Texture dimensions
        DWORD   m_dwTexHeight;
        FLOAT   m_fTextScale;
        FLOAT   m_fTexCoords[128-32][4];
        DWORD   m_dwSpacing;                  // Character pixel spacing per side
    
        // Stateblocks for setting and restoring render states
        LPDIRECT3DSTATEBLOCK9 m_pStateBlockSaved;
        LPDIRECT3DSTATEBLOCK9 m_pStateBlockDrawText;
    
    public:
        // 2D and 3D text drawing functions
        HRESULT DrawText( FLOAT x, FLOAT y, DWORD dwColor, 
                          const TCHAR* strText, DWORD dwFlags=0L );
        HRESULT DrawTextScaled( FLOAT x, FLOAT y, FLOAT z, 
                                FLOAT fXScale, FLOAT fYScale, DWORD dwColor, 
                                const TCHAR* strText, DWORD dwFlags=0L );
        HRESULT Render3DText( const TCHAR* strText, DWORD dwFlags=0L );
        
        // Function to get extent of text
        HRESULT GetTextExtent( const TCHAR* strText, SIZE* pSize );
    
        // Initializing and destroying device-dependent objects
        HRESULT InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice );
        HRESULT RestoreDeviceObjects();
        HRESULT InvalidateDeviceObjects();
        HRESULT DeleteDeviceObjects();
    
        // Constructor / destructor
        CD3DFont( const TCHAR* strFontName, DWORD dwHeight, DWORD dwFlags=0L );
        ~CD3DFont();
    };
    
    
    
    
    #endif

    d3dfont9.cpp
    Code:
    // -----------------------------------------------------------------------------
    // File: D3DFont.cpp
    // Desc: Texture-based font class
    // Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
    //
    // Changes by Hans211
    // - Added D3D_FONT_RIGHT
    // - Stripped not needed functions
    // -----------------------------------------------------------------------------
    #include <stdio.h>
    #include <tchar.h>
    #include <D3DX9.h>
    #include "D3DFont9.h"
    #pragma warning(disable: 4996)
    //-----------------------------------------------------------------------------
    // Custom vertex types for rendering text
    //-----------------------------------------------------------------------------
    #define MAX_NUM_VERTICES 50*6
    struct FONT2DVERTEX { D3DXVECTOR4 p;   DWORD color;     FLOAT tu, tv; };
    struct FONT3DVERTEX { D3DXVECTOR3 p;   D3DXVECTOR3 n;   FLOAT tu, tv; };
    #define D3DFVF_FONT2DVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1)
    #define D3DFVF_FONT3DVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1)
    inline FONT2DVERTEX InitFont2DVertex( const D3DXVECTOR4& p, D3DCOLOR color,
                                          FLOAT tu, FLOAT tv )
    {
        FONT2DVERTEX v;   v.p = p;   v.color = color;   v.tu = tu;   v.tv = tv;
        return v;
    }
    inline FONT3DVERTEX InitFont3DVertex( const D3DXVECTOR3& p, const D3DXVECTOR3& n,
                                          FLOAT tu, FLOAT tv )
    {
        FONT3DVERTEX v;   v.p = p;   v.n = n;   v.tu = tu;   v.tv = tv;
        return v;
    }
     
    
    //-----------------------------------------------------------------------------
    // Name: CD3DFont()
    // Desc: Font class constructor
    //-----------------------------------------------------------------------------
    CD3DFont::CD3DFont( const TCHAR* strFontName, DWORD dwHeight, DWORD dwFlags )
    {
        _***ncpy( m_strFontName, strFontName, sizeof(m_strFontName) / sizeof(TCHAR) );
        m_strFontName[sizeof(m_strFontName) / sizeof(TCHAR) - 1] = _T('\0');
        m_dwFontHeight         = dwHeight;
        m_dwFontFlags          = dwFlags;
        m_dwSpacing            = 0;
        m_pd3dDevice           = NULL;
        m_pTexture             = NULL;
        m_pVB                  = NULL;
        m_pStateBlockSaved     = NULL;
        m_pStateBlockDrawText  = NULL;
    }
     
    
    //-----------------------------------------------------------------------------
    // Name: ~CD3DFont()
    // Desc: Font class destructor
    //-----------------------------------------------------------------------------
    CD3DFont::~CD3DFont()
    {
        InvalidateDeviceObjects();
        DeleteDeviceObjects();
    }
     
    
    //-----------------------------------------------------------------------------
    // Name: InitDeviceObjects()
    // Desc: Initializes device-dependent objects, including the vertex buffer used
    //       for rendering text and the texture map which stores the font image.
    //-----------------------------------------------------------------------------
    HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice )
    {
        HRESULT hr;
        // Keep a local copy of the device
        m_pd3dDevice = pd3dDevice;
        // Establish the font and texture size
        m_fTextScale  = 1.0f; // Draw fonts into texture without scaling
        // Large fonts need larger textures
        if( m_dwFontHeight > 60 )
            m_dwTexWidth = m_dwTexHeight = 2048;
        else if( m_dwFontHeight > 30 )
            m_dwTexWidth = m_dwTexHeight = 1024;
        else if( m_dwFontHeight > 15 )
            m_dwTexWidth = m_dwTexHeight = 512;
        else
            m_dwTexWidth  = m_dwTexHeight = 256;
        // If requested texture is too big, use a smaller texture and smaller font,
        // and scale up when rendering.
        D3DCAPS9 d3dCaps;
        m_pd3dDevice->GetDeviceCaps( &d3dCaps );
        if( m_dwTexWidth > d3dCaps.MaxTextureWidth )
        {
            m_fTextScale = (FLOAT)d3dCaps.MaxTextureWidth / (FLOAT)m_dwTexWidth;
            m_dwTexWidth = m_dwTexHeight = d3dCaps.MaxTextureWidth;
        }
        // Create a new texture for the font
        hr = m_pd3dDevice->CreateTexture( m_dwTexWidth, m_dwTexHeight, 1,
                                          0, D3DFMT_A4R4G4B4,
                                          D3DPOOL_MANAGED, &m_pTexture, NULL );
        if( FAILED(hr) )
            return hr;
        // Prepare to create a bitmap
        DWORD*      pBitmapBits;
        BITMAPINFO bmi;
        ZeroMemory( &bmi.bmiHeader,  sizeof(BITMAPINFOHEADER) );
        bmi.bmiHeader.biSize        = sizeof(BITMAPINFOHEADER);
        bmi.bmiHeader.biWidth       =  (int)m_dwTexWidth;
        bmi.bmiHeader.biHeight      = -(int)m_dwTexHeight;
        bmi.bmiHeader.biPlanes      = 1;
        bmi.bmiHeader.biCompression = BI_RGB;
        bmi.bmiHeader.biBitCount    = 32;
        // Create a DC and a bitmap for the font
        HDC     hDC       = CreateCompatibleDC( NULL );
        HBITMAP hbmBitmap = CreateDIBSection( hDC, &bmi, DIB_RGB_COLORS,
                                              (void**)&pBitmapBits, NULL, 0 );
        SetMapMode( hDC, MM_TEXT );
        // Create a font.  By specifying ANTIALIASED_QUALITY, we might get an
        // antialiased font, but this is not guaranteed.
        INT nHeight    = -MulDiv( m_dwFontHeight, 
            (INT)(GetDeviceCaps(hDC, LOGPIXELSY) * m_fTextScale), 72 );
        DWORD dwBold   = (m_dwFontFlags&D3DFONT_BOLD)   ? FW_BOLD : FW_NORMAL;
        DWORD dwItalic = (m_dwFontFlags&D3DFONT_ITALIC) ? TRUE    : FALSE;
        HFONT hFont    = CreateFont( nHeight, 0, 0, 0, dwBold, dwItalic,
                              FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
                              CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY,
                              VARIABLE_PITCH, m_strFontName );
        if( NULL==hFont )
            return E_FAIL;
        SelectObject( hDC, hbmBitmap );
        SelectObject( hDC, hFont );
        // Set text properties
        SetTextColor( hDC, RGB(255,255,255) );
        SetBkColor(   hDC, 0x00000000 );
        SetTextAlign( hDC, TA_TOP );
        // Loop through all printable character and output them to the bitmap..
        // Meanwhile, keep track of the corresponding tex coords for each character.
        DWORD x = 0;
        DWORD y = 0;
        TCHAR str[2] = _T("x");
        SIZE size;
        // Calculate the spacing between characters based on line height
        GetTextExtentPoint32( hDC, TEXT(" "), 1, &size );
        x = m_dwSpacing = (DWORD) ceil(size.cy * 0.3f);
        for( TCHAR c=32; c<127; c++ )
        {
            str[0] = c;
            GetTextExtentPoint32( hDC, str, 1, &size );
            if( (DWORD)(x + size.cx + m_dwSpacing) > m_dwTexWidth )
            {
                x  = m_dwSpacing;
                y += size.cy+1;
            }
            ExtTextOut( hDC, x+0, y+0, ETO_OPAQUE, NULL, str, 1, NULL );
            m_fTexCoords[c-32][0] = ((FLOAT)(x + 0       - m_dwSpacing))/m_dwTexWidth;
            m_fTexCoords[c-32][1] = ((FLOAT)(y + 0       + 0          ))/m_dwTexHeight;
            m_fTexCoords[c-32][2] = ((FLOAT)(x + size.cx + m_dwSpacing))/m_dwTexWidth;
            m_fTexCoords[c-32][3] = ((FLOAT)(y + size.cy + 0          ))/m_dwTexHeight;
            x += size.cx + (2 * m_dwSpacing);
        }
        // Lock the surface and write the alpha values for the set pixels
        D3DLOCKED_RECT d3dlr;
        m_pTexture->LockRect( 0, &d3dlr, 0, 0 );
        BYTE* pDstRow = (BYTE*)d3dlr.pBits;
        WORD* pDst16;
        BYTE bAlpha; // 4-bit measure of pixel intensity
        for( y=0; y < m_dwTexHeight; y++ )
        {
            pDst16 = (WORD*)pDstRow;
            for( x=0; x < m_dwTexWidth; x++ )
            {
                bAlpha = (BYTE)((pBitmapBits[m_dwTexWidth*y + x] & 0xff) >> 4);
                if (bAlpha > 0)
                {
                    *pDst16++ = (WORD) ((bAlpha << 12) | 0x0fff);
                }
                else
                {
                    *pDst16++ = 0x0000;
                }
            }
            pDstRow += d3dlr.Pitch;
        }
        // Done updating texture, so clean up used objects
        m_pTexture->UnlockRect(0);
        DeleteObject( hbmBitmap );
        DeleteDC( hDC );
        DeleteObject( hFont );
        return S_OK;
    }
     
    
    //-----------------------------------------------------------------------------
    // Name: RestoreDeviceObjects()
    // Desc:
    //-----------------------------------------------------------------------------
    HRESULT CD3DFont::RestoreDeviceObjects()
    {
        HRESULT hr;
        // Create vertex buffer for the letters
        int vertexSize = max( sizeof(FONT2DVERTEX), sizeof(FONT3DVERTEX ) );
        if( FAILED( hr = m_pd3dDevice->CreateVertexBuffer( MAX_NUM_VERTICES * vertexSize,
                                                           D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC, 0,
                                                           D3DPOOL_DEFAULT, &m_pVB, NULL ) ) )
        {
            return hr;
        }
        // Create the state blocks for rendering text
        for( UINT which=0; which<2; which++ )
        {
            m_pd3dDevice->BeginStateBlock();
            m_pd3dDevice->SetTexture( 0, m_pTexture );
            if ( D3DFONT_ZENABLE & m_dwFontFlags )
                m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
            else
                m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
            m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
            m_pd3dDevice->SetRenderState( D3DRS_SRCBLEND,   D3DBLEND_SRCALPHA );
            m_pd3dDevice->SetRenderState( D3DRS_DESTBLEND,  D3DBLEND_INVSRCALPHA );
            m_pd3dDevice->SetRenderState( D3DRS_ALPHATESTENABLE,  TRUE );
            m_pd3dDevice->SetRenderState( D3DRS_ALPHAREF,         0x08 );
            m_pd3dDevice->SetRenderState( D3DRS_ALPHAFUNC,  D3DCMP_GREATEREQUAL );
            m_pd3dDevice->SetRenderState( D3DRS_FILLMODE,   D3DFILL_SOLID );
            m_pd3dDevice->SetRenderState( D3DRS_CULLMODE,   D3DCULL_CCW );
            m_pd3dDevice->SetRenderState( D3DRS_STENCILENABLE,    FALSE );
            m_pd3dDevice->SetRenderState( D3DRS_CLIPPING,         TRUE );
            m_pd3dDevice->SetRenderState( D3DRS_CLIPPLANEENABLE,  FALSE );
            m_pd3dDevice->SetRenderState( D3DRS_VERTEXBLEND,      D3DVBF_DISABLE );
            m_pd3dDevice->SetRenderState( D3DRS_INDEXEDVERTEXBLENDENABLE, FALSE );
            m_pd3dDevice->SetRenderState( D3DRS_FOGENABLE,        FALSE );
            m_pd3dDevice->SetRenderState( D3DRS_COLORWRITEENABLE,
                D3DCOLORWRITEENABLE_RED  | D3DCOLORWRITEENABLE_GREEN |
                D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_ALPHA );
            m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_MODULATE );
            m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
            m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
            m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_MODULATE );
            m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
            m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
            m_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, 0 );
            m_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );
            m_pd3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP,   D3DTOP_DISABLE );
            m_pd3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP,   D3DTOP_DISABLE );
            m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT );
            m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
            m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE );
            if( which==0 )
                m_pd3dDevice->EndStateBlock( &m_pStateBlockSaved );
            else
                m_pd3dDevice->EndStateBlock( &m_pStateBlockDrawText );
        }
        return S_OK;
    }
    
    #define SAFE_RELEASE(p) if (p)  { free(p); p=NULL; }
    //-----------------------------------------------------------------------------
    // Name: InvalidateDeviceObjects()
    // Desc: Destroys all device-dependent objects
    //-----------------------------------------------------------------------------
    HRESULT CD3DFont::InvalidateDeviceObjects()
    {
        SAFE_RELEASE( m_pVB );
        SAFE_RELEASE( m_pStateBlockSaved );
        SAFE_RELEASE( m_pStateBlockDrawText );
        return S_OK;
    }
    
    //-----------------------------------------------------------------------------
    // Name: DeleteDeviceObjects()
    // Desc: Destroys all device-dependent objects
    //-----------------------------------------------------------------------------
    HRESULT CD3DFont::DeleteDeviceObjects()
    {
        SAFE_RELEASE( m_pTexture );
        m_pd3dDevice = NULL;
        return S_OK;
    }
    
    //-----------------------------------------------------------------------------
    // Name: GetTextExtent()
    // Desc: Get the dimensions of a text string
    //-----------------------------------------------------------------------------
    HRESULT CD3DFont::GetTextExtent( const TCHAR* strText, SIZE* pSize )
    {
        if( NULL==strText || NULL==pSize )
            return E_FAIL;
        FLOAT fRowWidth  = 0.0f;
        FLOAT fRowHeight = (m_fTexCoords[0][3]-m_fTexCoords[0][1])*m_dwTexHeight;
        FLOAT fWidth     = 0.0f;
        FLOAT fHeight    = fRowHeight;
        while( *strText )
        {
            TCHAR c = *strText++;
            if( c == _T('\n') )
            {
                fRowWidth = 0.0f;
                fHeight  += fRowHeight;
            }
            if( (c-32) < 0 || (c-32) >= 128-32 )
                continue;
            FLOAT tx1 = m_fTexCoords[c-32][0];
            FLOAT tx2 = m_fTexCoords[c-32][2];
            fRowWidth += (tx2-tx1)*m_dwTexWidth - 2*m_dwSpacing;
            if( fRowWidth > fWidth )
                fWidth = fRowWidth;
        }
        pSize->cx = (int)fWidth;
        pSize->cy = (int)fHeight;
        return S_OK;
    }
    
    //-----------------------------------------------------------------------------
    // Name: DrawText()
    // Desc: Draws 2D text. Note that sx and sy are in pixels
    //-----------------------------------------------------------------------------
    HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor,
                                const TCHAR* strText, DWORD dwFlags )
    {
        if( m_pd3dDevice == NULL )
            return E_FAIL;
        // Setup renderstate
        m_pStateBlockSaved->Capture();
        m_pStateBlockDrawText->Apply();
        m_pd3dDevice->SetFVF( D3DFVF_FONT2DVERTEX );
        m_pd3dDevice->SetPixelShader( NULL );
        m_pd3dDevice->SetStreamSource( 0, m_pVB, 0, sizeof(FONT2DVERTEX) );
        // Set filter states
        if( dwFlags & D3DFONT_FILTERED )
        {
            m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
            m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
        }
        if( dwFlags & D3DFONT_RIGHT ) {
            SIZE sz;
            GetTextExtent( strText, &sz );
            sx -= (FLOAT)sz.cx;
        } else if( dwFlags & D3DFONT_CENTER ) {
            SIZE sz;
            GetTextExtent( strText, &sz );
            sx -= (FLOAT)sz.cx/2.0f;
        }
        // Adjust for character spacing
        sx -= m_dwSpacing;
        FLOAT fStartX = sx;
        // Fill vertex buffer
        FONT2DVERTEX* pVertices = NULL;
        DWORD         dwNumTriangles = 0;
        m_pVB->Lock( 0, 0, (void**)&pVertices, D3DLOCK_DISCARD );
        while( *strText )
        {
            TCHAR c = *strText++;
            if( c == _T('\n') )
            {
                sx = fStartX;
                sy += (m_fTexCoords[0][3]-m_fTexCoords[0][1])*m_dwTexHeight;
            }
            if( (c-32) < 0 || (c-32) >= 128-32 )
                continue;
            FLOAT tx1 = m_fTexCoords[c-32][0];
            FLOAT ty1 = m_fTexCoords[c-32][1];
            FLOAT tx2 = m_fTexCoords[c-32][2];
            FLOAT ty2 = m_fTexCoords[c-32][3];
            FLOAT w = (tx2-tx1) *  m_dwTexWidth / m_fTextScale;
            FLOAT h = (ty2-ty1) * m_dwTexHeight / m_fTextScale;
            if( c != _T(' ') )
            {
                *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+h-0.5f,0.9f,1.0f), dwColor, tx1, ty2 );
                *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+0-0.5f,0.9f,1.0f), dwColor, tx1, ty1 );
                *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sy+h-0.5f,0.9f,1.0f), dwColor, tx2, ty2 );
                *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sy+0-0.5f,0.9f,1.0f), dwColor, tx2, ty1 );
                *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sy+h-0.5f,0.9f,1.0f), dwColor, tx2, ty2 );
                *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+0-0.5f,0.9f,1.0f), dwColor, tx1, ty1 );
                dwNumTriangles += 2;
                if( dwNumTriangles*3 > (MAX_NUM_VERTICES-6) )
                {
                    // Unlock, render, and relock the vertex buffer
                    m_pVB->Unlock();
                    m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
                    pVertices = NULL;
                    m_pVB->Lock( 0, 0, (void**)&pVertices, D3DLOCK_DISCARD );
                    dwNumTriangles = 0L;
                }
            }
            sx += w - (2 * m_dwSpacing);
        }
        // Unlock and render the vertex buffer
        m_pVB->Unlock();
        if( dwNumTriangles > 0 )
            m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
        // Restore the modified renderstates
        m_pStateBlockSaved->Apply();
        return S_OK;
    }
    wa_ipc.h
    Code:
    /*
    ** Copyright (C) 2003 Nullsoft, Inc.
    **
    ** This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held 
    ** liable for any damages arising from the use of this software. 
    **
    ** Permission is granted to anyone to use this software for any purpose, including commercial applications, and to 
    ** alter it and redistribute it freely, subject to the following restrictions:
    **
    **   1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. 
    **      If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
    **
    **   2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
    **
    **   3. This notice may not be removed or altered from any source distribution.
    **
    */
    #include <windows.h>
    #ifndef _WA_IPC_H_
    #define _WA_IPC_H_
    /*
    ** This is the modern replacement for the classic 'frontend.h'. Most of these 
    ** updates are designed for in-process use, i.e. from a plugin.
    **
    */
    /* message used to sent many messages to winamp's main window. 
    ** most all of the IPC_* messages involve sending the message in the form of:
    **   result = SendMessage(hwnd_winamp,WM_WA_IPC,(parameter),IPC_*);
    */
    #define WM_WA_IPC WM_USER
    /* but some of them use WM_COPYDATA. be afraid.
    */
    #define IPC_GETVERSION 0
    /* int version = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION);
    **
    ** Version will be 0x20yx for winamp 2.yx. versions previous to Winamp 2.0
    ** typically (but not always) use 0x1zyx for 1.zx versions. Weird, I know.
    */
    #define IPC_GETREGISTEREDVERSION 770
    
    typedef struct {
      char *filename;
      char *title;
      int length;
    } enqueueFileWithMetaStruct; // send this to a IPC_PLAYFILE in a non WM_COPYDATA, 
    // and you get the nice desired result. if title is NULL, it is treated as a "thing",
    // otherwise it's assumed to be a file (for speed)
    #define IPC_PLAYFILE 100  // dont be fooled, this is really the same as enque*****
    #define IPC_ENQUEUEFILE 100 
    /* sent as a WM_COPYDATA, with IPC_PLAYFILE as the dwData, and the string to play
    ** as the lpData. Just enqueues, does not clear the playlist or change the playback
    ** state.
    */
    
    #define IPC_DELETE 101
    #define IPC_DELETE_INT 1101 // don't use this, it's used internally by winamp when 
                                // dealing with some lame explorer issues.
    /* SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE);
    ** Use IPC_DELETE to clear Winamp's internal playlist.
    */
    
    #define IPC_STARTPLAY 102   // starts playback. almost like hitting play in Winamp.
    #define IPC_STARTPLAY_INT 1102 // used internally, don't bother using it (won't be any fun)
    
    #define IPC_CHDIR 103
    /* sent as a WM_COPYDATA, with IPC_CHDIR as the dwData, and the directory to change to
    ** as the lpData. 
    */
    
    #define IPC_ISPLAYING 104
    /* int res = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING);
    ** If it returns 1, it is playing. if it returns 3, it is paused, 
    ** if it returns 0, it is not playing.
    */
    
    #define IPC_GETOUTPUTTIME 105
    /* int res = SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME);
    ** returns the position in milliseconds of the current track (mode = 0), 
    ** or the track length, in seconds (mode = 1). Returns -1 if not playing or error.
    */
    
    #define IPC_JUMPTOTIME 106
    /* (requires Winamp 1.60+)
    ** SendMessage(hwnd_winamp,WM_WA_IPC,ms,IPC_JUMPTOTIME);
    ** IPC_JUMPTOTIME sets the position in milliseconds of the 
    ** current song (approximately).
    ** Returns -1 if not playing, 1 on eof, or 0 if successful
    */
    #define IPC_GETMODULENAME 109
    #define IPC_EX_ISRIGHTEXE 666
    /* usually shouldnt bother using these, but here goes:
    ** send a WM_COPYDATA with IPC_GETMODULENAME, and an internal
    ** flag gets set, which if you send a normal WM_WA_IPC message with
    ** IPC_EX_ISRIGHTEXE, it returns whether or not that filename
    ** matches. lame, I know.
    */
    #define IPC_WRITEPLAYLIST 120
    /* (requires Winamp 1.666+)
    ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST);
    **
    ** IPC_WRITEPLAYLIST writes the current playlist to <winampdir>\\Winamp.m3u,
    ** and returns the current playlist position.
    ** Kinda obsoleted by some of the 2.x new stuff, but still good for when
    ** using a front-end (instead of a plug-in)
    */
    
    #define IPC_SETPLAYLISTPOS 121
    /* (requires Winamp 2.0+)
    ** SendMessage(hwnd_winamp,WM_WA_IPC,position,IPC_SETPLAYLISTPOS)
    ** IPC_SETPLAYLISTPOS sets the playlist position to 'position'. It
    ** does not change playback or anything, it just sets position, and
    ** updates the view if necessary
    */
    
    #define IPC_SETVOLUME 122
    /* (requires Winamp 2.0+)
    ** SendMessage(hwnd_winamp,WM_WA_IPC,volume,IPC_SETVOLUME);
    ** IPC_SETVOLUME sets the volume of Winamp (from 0-255).
    */
    
    #define IPC_SETPANNING 123
    /* (requires Winamp 2.0+)
    ** SendMessage(hwnd_winamp,WM_WA_IPC,panning,IPC_SETPANNING);
    ** IPC_SETPANNING sets the panning of Winamp (from 0 (left) to 255 (right)).
    */
    
    #define IPC_GETLISTLENGTH 124
    /* (requires Winamp 2.0+)
    ** int length = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTLENGTH);
    ** IPC_GETLISTLENGTH returns the length of the current playlist, in
    ** tracks.
    */
    
    #define IPC_GETLISTPOS 125
    /* (requires Winamp 2.05+)
    ** int pos=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS);
    ** IPC_GETLISTPOS returns the playlist position. A lot like IPC_WRITEPLAYLIST
    ** only faster since it doesn't have to write out the list. Heh, silly me.
    */
    
    #define IPC_GETINFO 126
    /* (requires Winamp 2.05+)
    ** int inf=SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETINFO);
    ** IPC_GETINFO returns info about the current playing song. The value
    ** it returns depends on the value of 'mode'.
    ** Mode      Meaning
    ** ------------------
    ** 0         Samplerate (i.e. 44100)
    ** 1         Bitrate  (i.e. 128)
    ** 2         Channels (i.e. 2)
    ** 3 (5+)    Video LOWORD=w HIWORD=h
    ** 4 (5+)    > 65536, string (video description)
    */
    
    #define IPC_GETEQDATA 127
    /* (requires Winamp 2.05+)
    ** int data=SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);
    ** IPC_GETEQDATA queries the status of the EQ. 
    ** The value returned depends on what 'pos' is set to:
    ** Value      Meaning
    ** ------------------
    ** 0-9        The 10 bands of EQ data. 0-63 (+20db - -20db)
    ** 10         The preamp value. 0-63 (+20db - -20db)
    ** 11         Enabled. zero if disabled, nonzero if enabled.
    ** 12         Autoload. zero if disabled, nonzero if enabled.
    */
    
    #define IPC_SETEQDATA 128
    /* (requires Winamp 2.05+)
    ** SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);
    ** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SETEQDATA);
    ** IPC_SETEQDATA sets the value of the last position retrieved
    ** by IPC_GETEQDATA. This is pretty lame, and we should provide
    ** an extended version that lets you do a MAKELPARAM(pos,value).
    ** someday...
      new (2.92+): 
        if the high byte is set to 0xDB, then the third byte specifies
        which band, and the bottom word specifies the value.
    */
    #define IPC_ADDBOOKMARK 129
    /* (requires Winamp 2.4+)
    ** Sent as a WM_COPYDATA, using IPC_ADDBOOKMARK, adds the specified
    ** file/url to the Winamp bookmark list.
    */
    /*
    In winamp 5+, we use this as a normal WM_WA_IPC and the string:
      "filename\0title\0"
      to notify the library/bookmark editor that a bookmark
    was added. Note that using this message in this context does not
    actually add the bookmark.
    do not use :)
    */
    
    #define IPC_INSTALLPLUGIN 130
    /* not implemented, but if it was you could do a WM_COPYDATA with 
    ** a path to a .wpz, and it would install it.
    */
    
    #define IPC_RESTARTWINAMP 135
    /* (requires Winamp 2.2+)
    ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_RESTARTWINAMP);
    ** IPC_RESTARTWINAMP will restart Winamp (isn't that obvious ? :)
    */
    
    #define IPC_ISFULLSTOP 400
    /* (requires winamp 2.7+ I think)
    ** ret=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISFULLSTOP);
    ** useful for when you're an output plugin, and you want to see
    ** if the stop/close is a full stop, or just between tracks.
    ** returns nonzero if it's full, zero if it's just a new track.
    */
    
    #define IPC_INETAVAILABLE 242
    /* (requires Winamp 2.05+)
    ** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_INETAVAILABLE);
    ** IPC_INETAVAILABLE will return 1 if the Internet connection is available for Winamp.
    */
    
    #define IPC_UPDTITLE 243
    /* (requires Winamp 2.2+)
    ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_UPDTITLE);
    ** IPC_UPDTITLE will ask Winamp to update the informations about the current title.
    */
    
    #define IPC_REFRESHPLCACHE 247
    /* (requires Winamp 2.2+)
    ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_REFRESHPLCACHE);
    ** IPC_REFRESHPLCACHE will flush the playlist cache buffer.
    ** (send this if you want it to go refetch titles for tracks)
    */
    
    #define IPC_GET_SHUFFLE 250
    /* (requires Winamp 2.4+)
    ** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_SHUFFLE);
    **
    ** IPC_GET_SHUFFLE returns the status of the Shuffle option (1 if set)
    */
    
    #define IPC_GET_REPEAT 251
    /* (requires Winamp 2.4+)
    ** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_REPEAT);
    **
    ** IPC_GET_REPEAT returns the status of the Repeat option (1 if set)
    */
    
    #define IPC_SET_SHUFFLE 252
    /* (requires Winamp 2.4+)
    ** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_SHUFFLE);
    **
    ** IPC_SET_SHUFFLE sets the status of the Shuffle option (1 to turn it on)
    */
    
    #define IPC_SET_REPEAT 253
    /* (requires Winamp 2.4+)
    ** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_REPEAT);
    **
    ** IPC_SET_REPEAT sets the status of the Repeat option (1 to turn it on)
    */
    
    #define IPC_ENABLEDISABLE_ALL_WINDOWS 259 // 0xdeadbeef to disable
    /* (requires Winamp 2.9+)
    ** SendMessage(hwnd_winamp,WM_WA_IPC,enable?0:0xdeadbeef,IPC_MBOPENREAL);
    ** sending with 0xdeadbeef as the param disables all winamp windows, 
    ** any other values will enable all winamp windows.
    */
    
    #define IPC_GETWND 260
    /* (requires Winamp 2.9+)
    ** HWND h=SendMessage(hwnd_winamp,WM_WA_IPC,IPC_GETWND_xxx,IPC_GETWND);
    ** returns the HWND of the window specified.
    */
      #define IPC_GETWND_EQ 0 // use one of these for the param
      #define IPC_GETWND_PE 1
      #define IPC_GETWND_MB 2
      #define IPC_GETWND_VIDEO 3
    #define IPC_ISWNDVISIBLE 261 // same param as IPC_GETWND
     
    
    /************************************************************************
    ***************** in-process only (WE LOVE PLUGINS)
    ************************************************************************/
    
    #define IPC_SETSKIN 200
    /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
    ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"skinname",IPC_SETSKIN);
    ** IPC_SETSKIN sets the current skin to "skinname". Note that skinname 
    ** can be the name of a skin, a skin .zip file, with or without path. 
    ** If path isn't specified, the default search path is the winamp skins 
    ** directory.
    */
    
    #define IPC_GETSKIN 201
    /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
    ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)skinname_buffer,IPC_GETSKIN);
    ** IPC_GETSKIN puts the directory where skin bitmaps can be found 
    ** into  skinname_buffer.
    ** skinname_buffer must be MAX_PATH characters in length.
    ** When using a .zip'd skin file, it'll return a temporary directory
    ** where the ZIP was decompressed.
    */
    
    #define IPC_EXECPLUG 202
    /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
    ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"vis_file.dll",IPC_EXECPLUG);
    ** IPC_EXECPLUG executes a visualization plug-in pointed to by WPARAM.
    ** the format of this string can be:
    ** "vis_whatever.dll"
    ** "vis_whatever.dll,0" // (first mod, file in winamp plug-in dir)
    ** "C:\\dir\\vis_whatever.dll,1" 
    */
    
    #define IPC_GETPLAYLISTFILE 211
    /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
    ** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTFILE);
    ** IPC_GETPLAYLISTFILE gets the filename of the playlist entry [index].
    ** returns a pointer to it. returns NULL on error.
    */
    
    #define IPC_GETPLAYLISTTITLE 212
    /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
    ** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTTITLE);
    **
    ** IPC_GETPLAYLISTTITLE gets the title of the playlist entry [index].
    ** returns a pointer to it. returns NULL on error.
    */
    
    #define IPC_GETHTTPGETTER 240
    /* retrieves a function pointer to a HTTP retrieval function.
    ** if this is unsupported, returns 1 or 0.
    ** the function should be:
    ** int (*httpRetrieveFile)(HWND hwnd, char *url, char *file, char *dlgtitle);
    ** if you call this function, with a parent window, a URL, an output file, and a dialog title,
    ** it will return 0 on successful download, 1 on error.
    */
    
    #define IPC_MBOPEN 241
    /* (requires Winamp 2.05+)
    ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_MBOPEN);
    ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPEN);
    ** IPC_MBOPEN will open a new URL in the minibrowser. if url is NULL, it will open the Minibrowser window.
    */
     
    #define IPC_CHANGECURRENTFILE 245
    /* (requires Winamp 2.05+)
    ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_CHANGECURRENTFILE);
    ** IPC_CHANGECURRENTFILE will set the current playlist item.
    */
    
    #define IPC_GETMBURL 246
    /* (requires Winamp 2.2+)
    ** char buffer[4096]; // Urls can be VERY long
    ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)buffer,IPC_GETMBURL);
    ** IPC_GETMBURL will retrieve the current Minibrowser URL into buffer.
    ** buffer must be at least 4096 bytes long.
    */
    
    #define IPC_MBBLOCK 248
    /* (requires Winamp 2.4+)
    ** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_MBBLOCK);
    **
    ** IPC_MBBLOCK will block the Minibrowser from updates if value is set to 1
    */
    #define IPC_MBOPENREAL 249
    /* (requires Winamp 2.4+)
    ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPENREAL);
    **
    ** IPC_MBOPENREAL works the same as IPC_MBOPEN except that it will works even if 
    ** IPC_MBBLOCK has been set to 1
    */
    #define IPC_ADJUST_OPTIONSMENUPOS 280
    /* (requires Winamp 2.9+)
    ** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_OPTIONSMENUPOS);
    ** moves where winamp expects the Options menu in the main menu. Useful if you wish to insert a
    ** menu item above the options/skins/vis menus.
    */
    #define IPC_GET_HMENU 281
    /* (requires Winamp 2.9+)
    ** HMENU hMenu=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)0,IPC_GET_HMENU);
    ** values for data:
    ** 0 : main popup menu 
    ** 1 : main menubar file menu
    ** 2 : main menubar options menu
    ** 3 : main menubar windows menu
    ** 4 : main menubar help menu
    ** other values will return NULL.
    */
    #define IPC_GET_EXTENDED_FILE_INFO 290 //pass a pointer to the following struct in wParam
    #define IPC_GET_EXTENDED_FILE_INFO_HOOKABLE 296
    /* (requires Winamp 2.9+)
    ** to use, create an extendedFileInfoStruct, point the values filename and metadata to the
    ** filename and metadata field you wish to query, and ret to a buffer, with retlen to the
    ** length of that buffer, and then SendMessage(hwnd_winamp,WM_WA_IPC,&struct,IPC_GET_EXTENDED_FILE_INFO);
    ** the results should be in the buffer pointed to by ret.
    ** returns 1 if the decoder supports a getExtendedFileInfo method
    */
    typedef struct {
      char *filename;
      char *metadata;
      char *ret;
      int retlen;
    } extendedFileInfoStruct;
    #define IPC_GET_BASIC_FILE_INFO 291 //pass a pointer to the following struct in wParam
    typedef struct {
      char *filename;
      int quickCheck; // set to 0 to always get, 1 for quick, 2 for default (if 2, quickCheck will be set to 0 if quick wasnot used)
      // filled in by winamp
      int length;
      char *title;
      int titlelen;
    } basicFileInfoStruct;
    #define IPC_GET_EXTLIST 292 //returns doublenull delimited. GlobalFree() it when done. if data is 0, returns raw extlist, if 1, returns something suitable for getopenfilename
    #define IPC_INFOBOX 293
    typedef struct {
      HWND parent;
      char *filename;
    } infoBoxParam;
    #define IPC_SET_EXTENDED_FILE_INFO 294 //pass a pointer to the a extendedFileInfoStruct in wParam
    /* (requires Winamp 2.9+)
    ** to use, create an extendedFileInfoStruct, point the values filename and metadata to the
    ** filename and metadata field you wish to write in ret. (retlen is not used). and then 
    ** SendMessage(hwnd_winamp,WM_WA_IPC,&struct,IPC_SET_EXTENDED_FILE_INFO);
    ** returns 1 if the metadata is supported
    ** Call IPC_WRITE_EXTENDED_FILE_INFO once you're done setting all the metadata you want to update
    */
    #define IPC_WRITE_EXTENDED_FILE_INFO 295 
    /* (requires Winamp 2.9+)
    ** writes all the metadata set thru IPC_SET_EXTENDED_FILE_INFO to the file
    ** returns 1 if the file has been successfully updated, 0 if error
    */
    #define IPC_FORMAT_TITLE 297
    typedef struct 
    {
      char *spec; // NULL=default winamp spec
      void *p;
      char *out;
      int out_len;
      char * (*TAGFUNC)(char * tag, void * p); //return 0 if not found
      void (*TAGFREEFUNC)(char * tag,void * p);
    } waFormatTitle;
    #define IPC_GETUNCOMPRESSINTERFACE 331
    /* returns a function pointer to uncompress().
    ** int (*uncompress)(unsigned char *dest, unsigned long *destLen, const unsigned char *source, unsigned long sourceLen);
    ** right out of zlib, useful for decompressing zlibbed data.
    ** if you pass the parm of 0x10100000, it will return a wa_inflate_struct * to an inflate API.
    */
    typedef struct {
      int (*inflateReset)(void *strm);
      int (*inflateInit_)(void *strm,const char *version, int stream_size);
      int (*inflate)(void *strm, int flush);
      int (*inflateEnd)(void *strm);
      unsigned long (*crc32)(unsigned long crc, const unsigned  char *buf, unsigned int len);
    } wa_inflate_struct;
    
    #define IPC_ADD_PREFS_DLG 332
    #define IPC_REMOVE_PREFS_DLG 333
    /* (requires Winamp 2.9+)
    ** to use, allocate a prefsDlgRec structure (either on the heap or some global
    ** data, but NOT on the stack), initialze the members:
    ** hInst to the DLL instance where the resource is located
    ** dlgID to the ID of the dialog,
    ** proc to the window procedure for the dialog
    ** name to the name of the prefs page in the prefs.
    ** where to 0 (eventually we may add more options)
    ** then, SendMessage(hwnd_winamp,WM_WA_IPC,&prefsRec,IPC_ADD_PREFS_DLG);
    **
    ** you can also IPC_REMOVE_PREFS_DLG with the address of the same prefsRec,
    ** but you shouldn't really ever have to.
    **
    */
    #define IPC_OPENPREFSTOPAGE 380 // pass an id of a builtin page, or a &prefsDlgRec of prefs page to open
    typedef struct _prefsDlgRec {
      HINSTANCE hInst;
      int dlgID;
      void *proc;
      char *name;
      int where; // 0 for options, 1 for plugins, 2 for skins, 3 for bookmarks, 4 for prefs
    
      int _id;
      struct _prefsDlgRec *next;
    } prefsDlgRec;
    
    #define IPC_GETINIFILE 334 // returns a pointer to winamp.ini
    #define IPC_GETINIDIRECTORY 335 // returns a pointer to the directory to put config files in (if you dont want to use winamp.ini)
    #define IPC_SPAWNBUTTONPOPUP 361 // param =
    // 0 = eject
    // 1 = previous
    // 2 = next
    // 3 = pause
    // 4 = play
    // 5 = stop
    #define IPC_OPENURLBOX 360 // pass a HWND to a parent, returns a HGLOBAL that needs to be freed with GlobalFree(), if successful
    #define IPC_OPENFILEBOX 362 // pass a HWND to a parent
    #define IPC_OPENDIRBOX 363 // pass a HWND to a parent
    // pass an HWND to a parent. call this if you take over the whole UI so that the dialogs are not appearing on the
    // bottom right of the screen since the main winamp window is at 3000x3000, call again with NULL to reset
    #define IPC_SETDIALOGBOXPARENT 364 
     
    // pass 0 for a copy of the skin HBITMAP
    // pass 1 for name of font to use for playlist editor likeness
    // pass 2 for font charset
    // pass 3 for font size
    #define IPC_GET_GENSKINBITMAP 503
    
    #define IPC_GET_EMBEDIF 505 // pass an embedWindowState
    // returns an HWND embedWindow(embedWindowState *); if the data is NULL, otherwise returns the HWND directly
    typedef struct
    {
      HWND me; //hwnd of the window
      int flags;
      RECT r;
      void *user_ptr; // for application use
      int extra_data[64]; // for internal winamp use
    } embedWindowState;
    #define EMBED_FLAGS_NORESIZE 1 // set this bit in embedWindowState.flags to keep window from being resizable
    #define EMBED_FLAGS_NOTRANSPARENCY 2 // set this bit in embedWindowState.flags to make gen_ff turn transparency off for this wnd
    
    #define IPC_EMBED_ENUM 532
    typedef struct embedEnumStruct
    {
      int (*enumProc)(embedWindowState *ws, struct embedEnumStruct *param); // return 1 to abort
      int user_data; // or more :)
    } embedEnumStruct;
      // pass 
    #define IPC_EMBED_ISVALID 533
    #define IPC_CONVERTFILE 506
    /* (requires Winamp 2.92+)
    ** Converts a given file to a different format (PCM, MP3, etc...)
    ** To use, pass a pointer to a waFileConvertStruct struct
    ** This struct can be either on the heap or some global
    ** data, but NOT on the stack. At least, until the conversion is done.
    **
    ** eg: SendMessage(hwnd_winamp,WM_WA_IPC,&myConvertStruct,IPC_CONVERTFILE);
    **
    ** Return value:
    ** 0: Can't start the conversion. Look at myConvertStruct->error for details.
    ** 1: Conversion started. Status messages will be sent to the specified callbackhwnd.
    **    Be sure to call IPC_CONVERTFILE_END when your callback window receives the
    **    IPC_CB_CONVERT_DONE message.
    */
    typedef struct 
    {
      char *sourcefile;  // "c:\\source.mp3"
      char *destfile;    // "c:\\dest.pcm"
      int destformat[8]; // like 'PCM ',srate,nch,bps
      HWND callbackhwnd; // window that will receive the IPC_CB_CONVERT notification messages
      
      //filled in by winamp.exe
      char *error;        //if IPC_CONVERTFILE returns 0, the reason will be here
      int bytes_done;     //you can look at both of these values for speed statistics
      int bytes_total;
      int bytes_out;
      int killswitch;     // don't set it manually, use IPC_CONVERTFILE_END
      int extra_data[64]; // for internal winamp use
    } convertFileStruct;
    #define IPC_CONVERTFILE_END 507
    /* (requires Winamp 2.92+)
    ** Stop/ends a convert process started from IPC_CONVERTFILE
    ** You need to call this when you receive the IPC_CB_CONVERTDONE message or when you
    ** want to abort a conversion process
    **
    ** eg: SendMessage(hwnd_winamp,WM_WA_IPC,&myConvertStruct,IPC_CONVERTFILE_END);
    **
    ** No return value
    */
    typedef struct {
      HWND hwndParent;
      int format;
      //filled in by winamp.exe
      HWND hwndConfig;
      int extra_data[8];
    } convertConfigStruct;
    #define IPC_CONVERT_CONFIG 508
    #define IPC_CONVERT_CONFIG_END 509
    typedef struct
    {
      void (*enumProc)(int user_data, const char *desc, int fourcc);
      int user_data;
    } converterEnumFmtStruct;
    #define IPC_CONVERT_CONFIG_ENUMFMTS 510
    /* (requires Winamp 2.92+)
    */
    
    typedef struct
    {
      char cdletter;
      char *playlist_file;
      HWND callback_hwnd;
      //filled in by winamp.exe
      char *error;
    } burnCDStruct;
    #define IPC_BURN_CD 511
    /* (requires Winamp 5.0+)
    */
    typedef struct
    {
      convertFileStruct *cfs;
      int priority;
    } convertSetPriority;
    #define IPC_CONVERT_SET_PRIORITY 512
    typedef struct
    {
      char *filename;
      char *title; // 2048 bytes
      int length;
      int force_useformatting; // can set this to 1 if you want to force a url to use title formatting shit
    } waHookTitleStruct;
    // return TRUE if you hook this
    #define IPC_HOOK_TITLES 850
    #define IPC_GETSADATAFUNC 800 
    // 0: returns a char *export_sa_get() that returns 150 bytes of data
    // 1: returns a export_sa_setreq(int want);
    #define IPC_ISMAINWNDVISIBLE 900
    
    #define IPC_SETPLEDITCOLORS 920
    typedef struct
    {
      int numElems;
      int *elems;
      HBITMAP bm; // set if you want to override
    } waSetPlColorsStruct;
    
    // the following IPC use waSpawnMenuParms as parameter
    #define IPC_SPAWNEQPRESETMENU 933
    #define IPC_SPAWN******NU 934 //menubar
    #define IPC_SPAWNOPTIONSMENU 935 //menubar
    #define IPC_SPAWNWINDOWSMENU 936 //menubar
    #define IPC_SPAWNHELPMENU 937 //menubar
    #define IPC_SPAWNPLAYMENU 938 //menubar
    #define IPC_SPAWNPE******NU 939 //menubar
    #define IPC_SPAWNPEPLAYLISTMENU 940 //menubar
    #define IPC_SPAWNPESORTMENU 941 //menubar
    #define IPC_SPAWNPEHELPMENU 942 //menubar
    #define IPC_SPAWNML******NU 943 //menubar
    #define IPC_SPAWNMLVIEWMENU 944 //menubar
    #define IPC_SPAWNMLHELPMENU 945 //menubar
    #define IPC_SPAWNPELISTOFPLAYLISTS 946
    typedef struct
    {
      HWND wnd;
      int xpos; // in screen coordinates
      int ypos;
    } waSpawnMenuParms;
    // waSpawnMenuParms2 is used by the menubar submenus
    typedef struct
    {
      HWND wnd;
      int xpos; // in screen coordinates
      int ypos;
      int width;
      int height;
    } waSpawnMenuParms2;
    
    // system tray sends this (you might want to simulate it)
    #define WM_WA_SYSTRAY WM_USER+1
    // input plugins send this when they are done playing back
    #define WM_WA_MPEG_EOF WM_USER+2
     
    //// video stuff
    #define IPC_IS_PLAYING_VIDEO 501 // returns >1 if playing, 0 if not, 1 if old version (so who knows):)
    #define IPC_GET_IVIDEOOUTPUT 500 // see below for IVideoOutput interface
    #define VIDEO_MAKETYPE(A,B,C,D) ((A) | ((B)<<8) | ((C)<<16) | ((D)<<24))
    #define VIDUSER_SET_INFOSTRING 0x1000
    #define VIDUSER_GET_VIDEOHWND  0x1001
    #define VIDUSER_SET_VFLIP      0x1002
    #ifndef NO_IVIDEO_DECLARE
    #ifdef __cplusplus
    class VideoOutput;
    class SubsItem;
    typedef struct {
     unsigned char* baseAddr;
     long   rowBytes;
    } YV12_PLANE;
    typedef struct {
     YV12_PLANE y;
     YV12_PLANE u;
     YV12_PLANE v;
    } YV12_PLANES;
    class IVideoOutput
    {
      public:
        virtual ~IVideoOutput() { }
        virtual int open(int w, int h, int vflip, double aspectratio, unsigned int fmt)=0;
        virtual void setcallback(LRESULT (*msgcallback)(void *token, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam), void *token) { }
        virtual void close()=0;
        virtual void draw(void *frame)=0;
        virtual void drawSubtitle(SubsItem *item) { }
        virtual void showStatusMsg(const char *text) { }
        virtual int get_latency() { return 0; }
        virtual void notifyBufferState(int bufferstate) { } /* 0-255*/
        virtual int extended(int param1, int param2, int param3) { return 0; } // Dispatchable, eat this!
    };
    #endif //cplusplus
    #endif//NO_IVIDEO_DECLARE
    // these messages are callbacks that you can grab by subclassing the winamp window
    // wParam = 
    #define IPC_CB_WND_EQ 0 // use one of these for the param
    #define IPC_CB_WND_PE 1
    #define IPC_CB_WND_MB 2
    #define IPC_CB_WND_VIDEO 3
    #define IPC_CB_WND_MAIN 4
    #define IPC_CB_ONSHOWWND 600 
    #define IPC_CB_ONHIDEWND 601 
    #define IPC_CB_GETTOOLTIP 602
    #define IPC_CB_MISC 603
        #define IPC_CB_MISC_TITLE 0
        #define IPC_CB_MISC_VOLUME 1 // volume/pan
        #define IPC_CB_MISC_STATUS 2
        #define IPC_CB_MISC_EQ 3
        #define IPC_CB_MISC_INFO 4
        #define IPC_CB_MISC_VIDEOINFO 5
    #define IPC_CB_CONVERT_STATUS 604 // param value goes from 0 to 100 (percent)
    #define IPC_CB_CONVERT_DONE   605
    #define IPC_ADJUST_FFWINDOWSMENUPOS 606
    /* (requires Winamp 2.9+)
    ** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_FFWINDOWSMENUPOS);
    ** moves where winamp expects the freeform windows in the menubar windows main menu. Useful if you wish to insert a
    ** menu item above extra freeform windows.
    */
    #define IPC_ISDOUBLESIZE 608
    #define IPC_ADJUST_FFOPTIONSMENUPOS 609
    /* (requires Winamp 2.9+)
    ** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_FFOPTIONSMENUPOS);
    ** moves where winamp expects the freeform preferences item in the menubar windows main menu. Useful if you wish to insert a
    ** menu item above preferences item.
    */
    #define IPC_GETTIMEDISPLAYMODE 610 // returns 0 if displaying elapsed time or 1 if displaying remaining time
    #define IPC_SETVISWND 611 // param is hwnd, setting this allows you to receive ID_VIS_NEXT/PREVOUS/RANDOM/FS wm_commands
    #define ID_VIS_NEXT                     40382
    #define ID_VIS_PREV                     40383
    #define ID_VIS_RANDOM                   40384
    #define ID_VIS_FS                       40389
    #define ID_VIS_CFG                      40390
    #define ID_VIS_MENU                     40391
    #define IPC_GETVISWND 612 // returns the vis cmd handler hwnd
    #define IPC_ISVISRUNNING 613
    #define IPC_CB_VISRANDOM 628 // param is status of random
    #define IPC_SETIDEALVIDEOSIZE 614 // sent by winamp to winamp, trap it if you need it. width=HIWORD(param), height=LOWORD(param)
    #define IPC_GETSTOPONVIDEOCLOSE 615
    #define IPC_SETSTOPONVIDEOCLOSE 616
    typedef struct {
      HWND hwnd;
      int uMsg;
      int wParam;
      int lParam;
    } transAccelStruct;
    #define IPC_TRANSLATEACCELERATOR 617
    typedef struct {
      int cmd;
      int x;
      int y;
      int align;
    } windowCommand; // send this as param to an IPC_PLCMD, IPC_MBCMD, IPC_VIDCMD
    #define IPC_CB_ONTOGGLEAOT 618 
    #define IPC_GETPREFSWND 619
    #define IPC_SET_PE_WIDTHHEIGHT 620 // data is a pointer to a POINT structure that holds width & height
    #define IPC_GETLANGUAGEPACKINSTANCE 621
    #define IPC_CB_PEINFOTEXT 622 // data is a string, ie: "04:21/45:02"
    #define IPC_CB_OUTPUTCHANGED 623 // output plugin was changed in config
    #define IPC_GETOUTPUTPLUGIN 625
    #define IPC_SETDRAWBORDERS 626
    #define IPC_DISABLESKINCURSORS 627
    #define IPC_CB_RESETFONT 629
    #define IPC_IS_FULLSCREEN 630 // returns 1 if video or vis is in fullscreen mode
    #define IPC_SET_VIS_FS_FLAG 631 // a vis should send this message with 1/as param to notify winamp that it has gone to or has come back from fullscreen mode
    #define IPC_SHOW_NOTIFICATION 632
    #define IPC_GETSKININFO 633
    // >>>>>>>>>>> Next is 634
    #define IPC_PLCMD  1000 
    #define PLCMD_ADD  0
    #define PLCMD_REM  1
    #define PLCMD_SEL  2
    #define PLCMD_MISC 3
    #define PLCMD_LIST 4
    #define IPC_MBCMD  1001 
    #define MBCMD_BACK    0
    #define MBCMD_FORWARD 1
    #define MBCMD_STOP    2
    #define MBCMD_RELOAD  3
    #define MBCMD_MISC  4
    #define IPC_VIDCMD 1002 
    #define VIDCMD_FULLSCREEN 0
    #define VIDCMD_1X         1
    #define VIDCMD_2X         2
    #define VIDCMD_LIB        3
    #define VIDPOPUP_MISC     4
    #define IPC_MBURL       1003 //sets the URL
    #define IPC_MBGETCURURL 1004 //copies the current URL into wParam (have a 4096 buffer ready)
    #define IPC_MBGETDESC   1005 //copies the current URL description into wParam (have a 4096 buffer ready)
    #define IPC_MBCHECKLOCFILE 1006 //checks that the link file is up to date (otherwise updates it). wParam=parent HWND
    #define IPC_MBREFRESH   1007 //refreshes the "now playing" view in the library
    #define IPC_MBGETDEFURL 1008 //copies the default URL into wParam (have a 4096 buffer ready)
    #define IPC_STATS_LIBRARY_ITEMCNT 1300 // updates library count status
    // IPC 2000-3000 reserved for freeform messages, see gen_ff/ff_ipc.h
    #define IPC_FF_FIRST 2000
    #define IPC_FF_LAST  3000
    #define IPC_GETDROPTARGET 3001
    #define IPC_PLAYLIST_MODIFIED 3002 // sent to main wnd whenever the playlist is modified
    #define IPC_PLAYING_FILE 3003 // sent to main wnd with the file as parm whenever a file is played
    #define IPC_FILE_TAG_MAY_HAVE_UPDATED 3004 // sent to main wnd with the file as parm whenever a file tag might be updated
    
    #define IPC_ALLOW_PLAYTRACKING 3007
    // send nonzero to allow, zero to disallow
    #define IPC_HOOK_OKTOQUIT 3010 // return 0 to abort a quit, nonzero if quit is OK
    #define IPC_WRITECONFIG 3011 // pass 2 to write all, 1 to write playlist + common, 0 to write common+less common
    // pass a string to be the name to register, and returns a value > 65536, which is a unique value you can use
    // for custom WM_WA_IPC messages. 
    #define IPC_REGISTER_WINAMP_IPCMESSAGE 65536 
    /**************************************************************************/
    /*
    ** Finally there are some WM_COMMAND messages that you can use to send 
    ** Winamp misc commands.
    ** 
    ** To send these, use:
    **
    ** SendMessage(hwnd_winamp, WM_COMMAND,command_name,0);
    */
    #define WINAMP_OPTIONS_EQ               40036 // toggles the EQ window
    #define WINAMP_OPTIONS_PLEDIT           40040 // toggles the playlist window
    #define WINAMP_VOLUMEUP                 40058 // turns the volume up a little
    #define WINAMP_VOLUMEDOWN               40059 // turns the volume down a little
    #define WINAMP_FFWD5S                   40060 // fast forwards 5 seconds
    #define WINAMP_REW5S                    40061 // rewinds 5 seconds
    // the following are the five main control buttons, with optionally shift 
    // or control pressed
    // (for the exact functions of each, just try it out)
    #define WINAMP_BUTTON1                  40044
    #define WINAMP_BUTTON2                  40045
    #define WINAMP_BUTTON3                  40046
    #define WINAMP_BUTTON4                  40047
    #define WINAMP_BUTTON5                  40048
    #define WINAMP_BUTTON1_SHIFT            40144
    #define WINAMP_BUTTON2_SHIFT            40145
    #define WINAMP_BUTTON3_SHIFT            40146
    #define WINAMP_BUTTON4_SHIFT            40147
    #define WINAMP_BUTTON5_SHIFT            40148
    #define WINAMP_BUTTON1_CTRL             40154
    #define WINAMP_BUTTON2_CTRL             40155
    #define WINAMP_BUTTON3_CTRL             40156
    #define WINAMP_BUTTON4_CTRL             40157
    #define WINAMP_BUTTON5_CTRL             40158
    #define WINAMP_FILE_PLAY                40029 // pops up the load file(s) box
    #define WINAMP_FILE_DIR                 40187 // pops up the load directory box
    #define WINAMP_OPTIONS_PREFS            40012 // pops up the preferences
    #define WINAMP_OPTIONS_AOT              40019 // toggles always on top
    #define WINAMP_HELP_ABOUT               40041 // pops up the about box :)
    #define ID_MAIN_PLAY_AUDIOCD1           40323 // starts playing the audio CD in the first CD reader
    #define ID_MAIN_PLAY_AUDIOCD2           40323 // plays the 2nd
    #define ID_MAIN_PLAY_AUDIOCD3           40323 // plays the 3nd
    #define ID_MAIN_PLAY_AUDIOCD4           40323 // plays the 4nd
    // IDs 42000 to 45000 are reserved for gen_ff
    // IDs from 45000 to 57000 are reserved for library 
    #endif//_WA_IPC_H_
    /*
    ** EOF.. Enjoy.
    */
    So will it work cause its real messy
    Last edited by xxxPROFINITYxxx; 08-16-2010 at 02:07 AM.

  2. #2
    markoj's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    s
    Posts
    1,064
    Reputation
    60
    Thanks
    407
    My Mood
    Bored
    Why wouldn't it work? It works for any d3d9 game, however it needs a lot of work....
    Proof:

    Dont ban me

  3. #3
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,198
    Reputation
    205
    Thanks
    1,445
    My Mood
    Mellow
    Why not compile and test yourself?

  4. #4
    whatup777's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    CA Source Code Section
    Posts
    4,025
    Reputation
    147
    Thanks
    351
    My Mood
    Dead
    You have to take out the DrawIndexedPrimitive. You cant Detour that.
    Quotes I live by.


    A foolish person learns from his mistakes, I wise person learns from others.
    Quote Originally Posted by AVGN View Post



    mhm

    i live in texas

    i was at the grocery store with my son. He saw a mexican guy, and he said "Look daddy! a mower man!"

    he's 4 yrs old

  5. #5
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,198
    Reputation
    205
    Thanks
    1,445
    My Mood
    Mellow
    Quote Originally Posted by whatup777 View Post
    You have to take out the DrawIndexedPrimitive. You cant Detour that.
    You can probably make it undetected if you hook a sub function.

  6. #6
    swatfx's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Posts
    659
    Reputation
    20
    Thanks
    108
    My Mood
    Mellow
    Quote Originally Posted by Void View Post
    You can probably make it undetected if you hook a sub function.
    we aren't all as good as you

  7. #7
    xxxPROFINITYxxx's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Kansas
    Posts
    62
    Reputation
    14
    Thanks
    2
    My Mood
    In Love
    Where do i put this stuff

    Code:
        if(IsBadReadPtr((void*)dwVA, 4)) return 0;        dwVA = *(DWORD*)dwVA;        if(!dwVA || IsBadReadPtr((void*)dwVA, 0x200)) return 0;        return dwVA + (4*index);}#define HOOKD3DAPI(a, b) \    if(*(DWORD*)GetAddressPtr(b) != (DWORD)&hk##a) { \        p##a = (a##_t) *(DWORD*)GetAddressPtr(b); \        *(DWORD*)GetAddressPtr(b) = (DWORD)&hk##a; \        *(DWORD*)GetD3DHSApi(b) = (DWORD)&hk##a; \    }DWORD WINAPI HookD3DApis(LPVOID){    bool bValid = false;    while(true) {        bValid = GetAddressPtr(0) > 0;        if(bValid) {            HOOKD3DAPI(Reset, 16)            HOOKD3DAPI(EndScene, 42)            HOOKD3DAPI(DrawIndexedPrimitive, 82)            HOOKD3DAPI(SetStreamSource, 100)        }                Sleep(300);    }    return 1;}
    and this

    Code:
    dwHSDevicePointer = g_pTools->dwFindPattern((DWORD)GetModuleHandle(ehsvc), 0x90000, (PBYTE)"\x8B\x84\x11\x00\x00\x00\x00\x8B\x8D\xCC\xFD\xFF\xFF\x8B\x95", "xxx????xxxxxxxx");    if(dwHSDevicePointer) {        dwHSDevicePointer = *(DWORD*)(dwHSDevicePointer+3);        dwHSDevicePointer += 0x10;    }DWORD dwTempDevicePointer = g_pTools->dwFindPattern((DWORD)GetModuleHandle(0), (DWORD)0xFFFFFFFF, (PBYTE)"\xA1\x00\x00\x00\x00\x89\x45\xF8\x8D", "x????xxxx");    if(dwTempDevicePointer) {        dwDevicePointer = *(DWORD*)(dwTempDevicePointer+1);    }
    Last edited by xxxPROFINITYxxx; 08-16-2010 at 04:24 AM.

  8. #8
    swatfx's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Posts
    659
    Reputation
    20
    Thanks
    108
    My Mood
    Mellow
    Quote Originally Posted by xxxPROFINITYxxx View Post
    Where do i put this stuff
    ?? umm your computer??
    ?? Visual C++ maybe???

    by the way that hooking the hackshield device pointer like that will now cause u to d/c

  9. #9
    xxxPROFINITYxxx's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Kansas
    Posts
    62
    Reputation
    14
    Thanks
    2
    My Mood
    In Love
    What are you talking bout????

  10. #10
    swatfx's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Posts
    659
    Reputation
    20
    Thanks
    108
    My Mood
    Mellow
    Quote Originally Posted by xxxPROFINITYxxx View Post
    What are you talking bout????
    Code:
    dwHSDevicePointer = g_pTools->dwFindPattern((DWORD)GetModuleHandle(ehsvc), 0x90000, (PBYTE)"\x8B\x84\x11\x00\x00\x00\x00\x8B\x8D\xCC\xFD\xFF\xFF\x8B\x95", "xxx????xxxxxxxx"); 
       if(dwHSDevicePointer) {        dwHSDevicePointer = *(DWORD*)(dwHSDevicePointer+3);
            dwHSDevicePointer += 0x10;
    ^^ that.. don't just copy stuff out of Gordon's hook without knowing what it does
    Last edited by swatfx; 08-16-2010 at 04:30 AM. Reason: added code tags

  11. #11
    xxxPROFINITYxxx's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Kansas
    Posts
    62
    Reputation
    14
    Thanks
    2
    My Mood
    In Love
    could u show me where to put it?

  12. #12
    swatfx's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Posts
    659
    Reputation
    20
    Thanks
    108
    My Mood
    Mellow
    Quote Originally Posted by xxxPROFINITYxxx View Post
    could u show me where to put it?
    i don't know i have never used the hybrid base..

    but u need to have a directX hook if there isn't one already and then u need to add the console hook since i don't think the hybrid base was made for CA

  13. #13
    xxxPROFINITYxxx's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Kansas
    Posts
    62
    Reputation
    14
    Thanks
    2
    My Mood
    In Love
    BOOL WINAPI DllMain(HMODULE hDll, DWORD dwReason, LPVOID lpReserved)
    {
    switch(dwReason)
    {
    case DLL_PROCESS_ATTACH:
    CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)Initialize, NULL, NULL, NULL);
    break;

    case DLL_PROCESS_DETACH:
    break;
    }

    return TRUE;
    }

    this is in my hack already he says it has something to do with initialize

  14. #14
    whatup777's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    CA Source Code Section
    Posts
    4,025
    Reputation
    147
    Thanks
    351
    My Mood
    Dead
    You obviously have no idea what your doing
    Quotes I live by.


    A foolish person learns from his mistakes, I wise person learns from others.
    Quote Originally Posted by AVGN View Post



    mhm

    i live in texas

    i was at the grocery store with my son. He saw a mexican guy, and he said "Look daddy! a mower man!"

    he's 4 yrs old

  15. #15
    swatfx's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Posts
    659
    Reputation
    20
    Thanks
    108
    My Mood
    Mellow
    Quote Originally Posted by whatup777 View Post
    You obviously have no idea what your doing
    mhmm...

    Go back to hotkey hack and actually learn some C++

Similar Threads

  1. Will this work?
    By -:TKK:-WaSsUp in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 6
    Last Post: 09-28-2010, 11:06 PM
  2. [HELP] Will This Work?
    By ^...,^ in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 9
    Last Post: 06-04-2010, 07:07 PM
  3. Will this work?
    By toonshorty in forum Call of Duty Modern Warfare 2 Help
    Replies: 8
    Last Post: 04-12-2010, 08:11 PM
  4. [REQUEST] Can you change the Damage of guns? Will this work?
    By W$fSEDfw435sef in forum Combat Arms Mod Discussion
    Replies: 8
    Last Post: 01-02-2010, 10:26 PM
  5. will this work?
    By mpentlan01 in forum WarRock - International Hacks
    Replies: 9
    Last Post: 06-08-2009, 12:32 PM