Go Back   UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats > Anti-Cheat Software & Programming > C and C++

- Sponsored Advertisement -
http://www.myfpscheats.com/

Welcome to the UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats.
You have to register before you can post and see and access any of the advanced forum features, please click the register link to proceed to the registration form. To start viewing threads or posts, select a forum that you want to visit from the selection below.
C and C++
hacking programming reversing
You are Unregistered, please register to gain Full access.    
Reply
 
Thread Tools

Song length/Play position
Old 02-08-2010, 08:41 PM   #1
Supreme G0d

.Encore's Avatar

Join Date: Dec 2009
Location: Inside 64k demo
Posts: 355
Reputation: 13471
Rep Power: 167
.Encore 's rep takes up 1 gig of server space.Encore 's rep takes up 1 gig of server space.Encore 's rep takes up 1 gig of server space.Encore 's rep takes up 1 gig of server space.Encore 's rep takes up 1 gig of server space.Encore 's rep takes up 1 gig of server space.Encore 's rep takes up 1 gig of server space.Encore 's rep takes up 1 gig of server space.Encore 's rep takes up 1 gig of server space.Encore 's rep takes up 1 gig of server space.Encore 's rep takes up 1 gig of server space
Points: 9,261, Level: 11
Points: 9,261, Level: 11 Points: 9,261, Level: 11 Points: 9,261, Level: 11
Activity: 9.2%
Activity: 9.2% Activity: 9.2% Activity: 9.2%
Last Achievements
Song length/Play position

Code:
#define WM_WA_IPC WM_USER
#define IPC_GETOUTPUTTIME 105
#define IPC_ISPLAYING 104
char boo[256];
char boo2[256];
char boo3[256];
char boo4[256];
char SongDuration[256];
char CurrentPosition[256];
unsigned int pos;
unsigned int length;
long SendWinampMessage( unsigned int iMsg, WPARAM wParam, LPARAM lParam )
{
    HWND hWinAmp = FindWindowA( "Winamp v1.x", 0 );

    DWORD ret = 0;
    SendMessageTimeoutA( hWinamp, iMsg, wParam, lParam, SMTO_BLOCK, 100, &ret );
    return dwRet;
}
int GetSongStatus( )
{
    return SendWinampMessage( WM_WA_IPC, 0, IPC_ISPLAYING );
}
void GetTime( )
{
    HWND winamp = FindWindow( "Winamp v1.x", NULL ); 
    float F_POS = SendMessage( winamp, WM_WA_IPC, 0, IPC_GETOUTPUTTIME );
    float F_LENGTH = SendMessage( winamp, WM_WA_IPC, 1, IPC_GETOUTPUTTIME );
    
    pos = ( unsigned int )F_POS;
    length = ( unsigned int )F_LENGTH;
}
void PrintTime( const unsigned int Value )
{
    if( Value == 0 )
        sprintf_s(boo,"00");
    else if( Value < 10 )
        sprintf_s(boo,"0%i",Value);
    else
        sprintf_s(boo,"%i",Value);
}
void PrintTime2( const unsigned int Value )
{
    if( Value == 0 )
        sprintf_s(boo2,"00");
    else if( Value < 10 )
        sprintf_s(boo2,"0%i",Value);
    else
        sprintf_s(boo2,"%i",Value);
}
void PrintTime3( const unsigned int Value )
{
    if( Value == 0 )
        sprintf_s(boo3,"00");
    else if( Value < 10 )
        sprintf_s(boo3,"0%i",Value);
    else
        sprintf_s(boo3,"%i",Value);
}
void PrintTime4( const unsigned int Value )
{
    if( Value == 0 )
        sprintf_s(boo4,"00");
    else if( Value < 10 )
        sprintf_s(boo4,"0%i",Value);
    else
        sprintf_s(boo4,"%i",Value);
}
void CalculateSongTimes( )
{
    const static unsigned int MILISECONDS_IN_AN_HOUR     = 3600000;
    const static unsigned int MILISECONDS_IN_A_MINUTE    = 60000;
    const static unsigned int MILISECONDS_IN_A_SECOND    = 1000;
    const static unsigned int SECONDS_IN_AN_HOUR         = 3600;
    const static unsigned int SECONDS_IN_A_MINUTE        = 60;
    if( length > 0 )
    {
        PrintTime( (unsigned int)((length % SECONDS_IN_AN_HOUR) / SECONDS_IN_A_MINUTE) );
        PrintTime2( (unsigned int)((length % SECONDS_IN_AN_HOUR) % SECONDS_IN_A_MINUTE) );
        sprintf_s(SongDuration,"%s:%s",boo,boo2);
    }
    else
        sprintf_s(SongDuration,"00:00");

    if( pos > 0 )
    {
        PrintTime3( (unsigned int)((pos % MILISECONDS_IN_AN_HOUR) / MILISECONDS_IN_A_MINUTE) );
        PrintTime4( (unsigned int)(((pos % MILISECONDS_IN_AN_HOUR) % MILISECONDS_IN_A_MINUTE) / MILISECONDS_IN_A_SECOND) );
        sprintf_s(CurrentPosition,"%s:%s",boo3,boo4);
    }
    else
        sprintf_s(CurrentPosition,"00:00");

    int Status = GetSongStatus( );
    if( Status == 0 )//1 - Playing | 3 - Paused | 0 - Stopped
        sprintf_s(CurrentPosition,"00:00");
}
There's no what to explain-as title says, you can get song length and current play position from WinAmp with this code.Just call GetTime( ) and CalculateSongTimes( ) functions, after that use "SongDuration" and "CurrentPosition" chars to get what you need.

Last edited by .Encore; 02-08-2010 at 11:51 PM.
.Encore is online now

Reply With Quote

Reply  

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google
  • Submit Thread to Facebook
  • Submit Thread to My Yahoo!
  • Submit Thread to MySpace
  • Submit Thread to Twitter
  • Submit Thread to Reddit



Tags
length or play, position, song
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT +1. The time now is 06:25 AM.