Never done this successfully before and can't seem to figure it out... Any help appreciated.

Basically this code draws my Winamp Track like this;
"Song Title - Song Artist - Winamp 0:00/0:00"
I would like to remove the - Winamp from the drawing if possible, any pointers or code would be appreciated.

#include <windows.h>
#include <stdio.h>

void PatchCall(DWORD dwAddr, DWORD dwFunc, DWORD dwLen);
#define INST_CALL 0xE8

int GetMaxTrackTime()
{
   HWND win = FindWindowA("Winamp v1.x",NULL);
   if(win)
   return SendMessage(win,WM_USER,1,105);

   return 0;
}

int GetCurrentTrackTime()
{
   HWND win = FindWindowA("Winamp v1.x",NULL);
   if(win)
   return SendMessage(win,WM_USER,0,105);

   return 0;
}

LPSTR GetCurrentWinampTrack()
{
   static char szTitle[2048];
   HWND win = FindWindowA("Winamp v1.x",NULL);
   if(!win)
   return "Winamp not found!";

   GetWindowTextA(win, szTitle, sizeof(szTitle));
   if(strlen(szTitle) <= 0)
   return "No name!";

   return szTitle;
}

The actual Drawing Function

VOID WinampTrack()
{
int ct = GetCurrentTrackTime();
int mt = GetMaxTrackTime();

   Texthook(120,500, 4,"%s; (%d:%02d/%d:%02d)",GetCurrentWinampTrack(),ct/(1000*60), (ct/1000)%60,mt/(60), (mt)%60);
}

An example I've seen elsewhere on removing it

if (!strnicmp(rTitle,"- Winamp",) break;
rTitle--;

Recommended Answers

All 3 Replies

So the goal is to have a function like this?

string RemoveWinampFromString (string beforeRemoval)
// if given "Korn - Evolution - WinAmp -2:00 / 3:30", 
// should return "Korn - Evolution - 2:00 / 3:30"

exactly

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.