Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3046

Direct Show Timer

$
0
0
Im coding a music player and I want the timer to stop when the music stops.

I got a static text with the lenght of the song. (the static text shows the position of the song in seconds....like 00:00:01,00:00:02..and it increments as the songs plays.....)

Ive messed around with WaitForCompletion but no luck

oh yeah..im using DIRECTSHOW and COM for the music player

here is a link to a picture so you know what im saying

http://postimage.org/image/51nm0hrqz/


(as you see..the static text has more time then the acual song lenght.)

here is soem of the acual code that i tried
so how do i get the song time to stop?


here is some code that doesnt work
Code:


timeElapsed++;
 long evCode;
       
        sprintf(time2, "%02u:%02u:%02u", (timeElapsed/3600)%60, (timeElapsed/60)%60, timeElapsed%60);


        SetDlgItemText(IDC_LENGHT1,time2);

  hr = pEvent->WaitForCompletion(0, &evCode);
        long EvCode = 0;
                        bool b = pEvent->WaitForCompletion(0, &EvCode);

                        if(b==TRUE)
                        {
                       
                                KillTimer(MY_TIMEREVENT);
                               
                        }

but it only goes to 1 second and stops

Viewing all articles
Browse latest Browse all 3046

Trending Articles