Archive

Archive for the ‘VB6’ Category

Reinventing the wheel…

November 30, 2010 Leave a comment

Having spent ages making my own Windows Media Payer OCX, I have just discovered that Microsoft already created one!

On the plus side I learned lot of stuff AND mine does exactly what I want it to do, so it was not all wasted time.

 

I’ve also decided to try and create my own slider control that will work with JQTouch instead of trying to force the jQuery UI one to work in a touch environment which it ‘almost’ does but not quite. All I have to do is convert the JQuery UI one to accept touch events instead of mouse events. Should be dead easy.

Yeah, right…

Categories: Coding, JQTouch, jQuery, VB6

Well that’s dumb…

November 28, 2010 Leave a comment

I found a problem with my media player control (of course). One of the things I wanted to do was have it report the duration of the media. However it seems that the Windows media player dll (wmp.dll) that it uses does not report that until the file is actually playing, which is pretty useless.

After a lot of Googling I found something that said if you put the media in a playlist it would work correctly. Tried it, still did not work. Then I found this code that does (so far anyway) seem to work:

Dim oMedia As IWMPMedia
Set oMedia = wmp.newMedia("C:\MyStuff\mp303 Johnny B Goode.mp3")
Dim dDummy As Double
Dim dDuration As Integer
dDummy = oMedia.duration
wmp.currentMedia = oMedia
dDuration = wmp.currentMedia.duration
MsgBox ("Duration=" & dDuration)

For some reason doing a dummy query of the media duration against the media object makes it work later on when you query the player itself.  Just seems a bit ‘daft’ to me. I mean, who the hell would figure that out (obviously someone did!) and why do it that way at all, why not just make it work like it should?

Anyway, I have updated the control source that is linked to in the earlier post to include this change.

Categories: Coding, VB6

Made a media player OCX

November 26, 2010 Leave a comment

I wrapped someVB6 code around the Windows medial player dll (wmp.dll) and made it into an OCX. Seems to work OK so I thought I’d post it here ‘just in case’ it is of any use to someone.

OCX code

Categories: Coding, VB6 Tags: