Sign in to follow this  
Followers 0
Champak

setPosition

7 posts in this topic

#1 ·  Posted (edited)

I'm trying to make a seek bar for my wmp object app. I came across setPosition in msdn, but can't seem to get it to work thus far and I'm wondering if setPosition is a VB function or is it specific to wmp object. I've seen examples of seek bar around, but all of them are for the "sound" udf and use soundseek. Any help?

Edited by Champak

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

OK, I figured the following out, however, I can't get the slider to "follow" the position of the song. When I try to do that, I can't get the slider to seek...so it is basically one or the other. Can I get some help?

#include <GUIConstants.au3>
$oWMP = ObjCreate("WMPlayer.OCX")

GUICreate("Player", 400, 100, 100, 100)
    $Play = GUICtrlCreateButton("Play", 10, 10, 50, 30)
    $Stop = GUICtrlCreateButton("Stop", 80, 10, 50, 30)
    $Position = GUICtrlCreateSlider( 5, 50, 330, 25 )
    $oWMP.URL = @DesktopDir & "\Song.mp3"
GUISetState(@SW_SHOW)

While 1

    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit

        Case $msg = $Play
             $oWMP.controls.play()

        Case $msg = $Stop
            $oWMP.controls.stop()

        Case $msg = $Position
            $oWMP.controls.currentPosition = GUICtrlRead($Position)
            
    EndSelect
    
    GUICtrlSetLimit($Position,$oWMP.currentMedia.duration,0)
    
WEnd
Edited by Champak

Share this post


Link to post
Share on other sites

That is what I did already. That is causing a fight between the actual/current position and trying to seek the new position...and the actual/current position is winning(Once the song starts and I try to drag the slider, it refuses to drag to where I want). That is why I said I'm only getting one or the other; I was putting that in the loop right under getting the duration.

Any other solutions?

Share this post


Link to post
Share on other sites

Bump

Share this post


Link to post
Share on other sites

You should look at this :

WMP.au3

It's an UDF with some WMP functions ...

Share this post


Link to post
Share on other sites

That is what I did already. That is causing a fight between the actual/current position and trying to seek the new position...and the actual/current position is winning(Once the song starts and I try to drag the slider, it refuses to drag to where I want). That is why I said I'm only getting one or the other; I was putting that in the loop right under getting the duration.

Any other solutions?

You'll need to determine whenever the slider is clicked, and if it is do the 'seeking', otherwise let it set current location...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0