Jump to content



Photo

Windows Media Player udf


  • Please log in to reply
25 replies to this topic

#1 ConsultingJoe

ConsultingJoe

    ConsultingJoe.com

  • Active Members
  • PipPipPipPipPipPip
  • 1,667 posts

Posted 07 June 2006 - 10:59 PM

This could look the same as if you were to embed a video in a website.
It embeds WMP into a gui, This is beta.
the example should help a lot
Let me know what you think
Thanks

UPDATED ON 09/06/07 WITH MORE FUNCTIONS

Plain Text         
#include <GUIConstants.au3> #include <wmp.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("AForm1", 518, 439, 192, 125) GUISetOnEvent($GUI_EVENT_CLOSE, "quit") $wmp = _wmpcreate(1, 8, 8, 425, 425);creates object _wmpvalue( $wmp, "nocontrols" );hides controls _wmploadmedia( $wmp, @HomeDrive & "\WINDOWS\clock.avi" );loads media ;_wmpsetvalue( $wmp, "controls" );shows controls $slider = GUICtrlCreateSlider( 4, 330, 330, 25 ) GUICtrlSetOnEvent( -1, "change" ) GUISetState(@SW_SHOW) While _wmpvalue($wmp,"getduration") = 0     Sleep(1) WEnd GUICtrlSetLimit($slider,_wmpvalue($wmp,"getduration"),0) GUISetState(@SW_SHOW) While 1 Sleep(100) GUICtrlSetData( $slider, _wmpvalue($wmp,"getposition")) WEnd Func quit()     Exit EndFunc Func change()     _wmpvalue($wmp,"setposition",GUICtrlRead($slider)) EndFunc


Plain Text         
#cs _wmpcreate($show, $left, $top, $width = 100, $height = 100) $show:   1 = shows controls         2 = hides controls Return: The object for the control #ce Func _wmpcreate($show, $left, $top, $width = 100, $height = 100) $oWMP = ObjCreate("WMPlayer.OCX") If $oWMP = 0 Then Return 0 $oWMP.settings.autoStart = "False" If $show = 1 Then     GUICtrlCreateObj($oWMP, $left, $top, $width, $height) EndIf Return $oWMP EndFunc #cs _wmploadmedia( $object, $URL, $autostart = 1 ) $object:    Object returned from the _wmpcreate() $URL:       Path or URL of the media $autostart: 1 = yes             0 = no Return: None #ce Func _wmploadmedia( $object, $URL, $autostart = 1 )     $object.URL = $URL     While Not $object.controls.isAvailable("play")         Sleep(1)     WEnd     If $autostart = 1 Then $object.controls.play() EndFunc #cs _wmpsetvalue( $object, $setting, $para=1 ) $object:    Object returned from the _wmpcreate() $setting:   "play"             "stop"             "pause"             "invisible" (Hides all)             "control"   (Shows controls)             "nocontrol" (Hides controls)             "fullscreen"             "step"      (frames to step before freezing)             "fastforward"             "fastreverse"             "volume"    (0 To 100)             "rate"      (-10 To 10)             "playcount" Return: None #ce Func _wmpvalue( $object, $setting, $para=1 )         Select             Case $setting = "play"             If $object.controls.isAvailable("play") Then $object.controls.play()         Case $setting = "stop"             If $object.controls.isAvailable("stop") Then $object.controls.stop()         Case $setting = "pause"             If $object.controls.isAvailable("pause") Then $object.controls.pause()         Case $setting = "invisible"             $object.uiMode = "invisible"         Case $setting = "controls"             $object.uiMode = "mini"         Case $setting = "nocontrols"             $object.uiMode = "none"         Case $setting = "fullscreen"             $object.fullscreen = "true"         Case $setting = "step"             If $object.controls.isAvailable("step") Then $object.controls.step($para)         Case $setting = "fastForward"             If $object.controls.isAvailable("fastForward") Then $object.controls.fastForward()         Case $setting = "fastReverse"             If $object.controls.isAvailable("fastReverse") Then $object.controls.fastReverse()         Case $setting = "volume"             $object.settings.volume = $para         Case $setting = "rate"             $object.settings.rate = $para         Case $setting = "playcount"             $object.settings.playCount = $para         Case $setting = "setposition"             $object.controls.currentPosition = $para         Case $setting = "getposition"             Return $object.controls.currentPosition         Case $setting = "getpositionstring";Returns HH:MM:SS             Return $object.controls.currentPositionString         Case $setting = "getduration"             Return $object.currentMedia.duration     EndSelect EndFunc

Edited by CyberZeroCool, 06 September 2007 - 08:59 PM.






#2 slightly_abnormal

slightly_abnormal

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 513 posts

Posted 08 June 2006 - 01:10 AM

this is nice :D

#3 ConsultingJoe

ConsultingJoe

    ConsultingJoe.com

  • Active Members
  • PipPipPipPipPipPip
  • 1,667 posts

Posted 08 June 2006 - 01:16 AM

this is nice :D

Thanks, its way better than my embeder that used IE to write and embed a web page

#4 ptrex

ptrex

    Universalist

  • MVPs
  • 2,399 posts

Posted 08 June 2006 - 07:33 AM

very nice :D

I like COM objects a lot and this one is a nice addition.

#5 J_Y_C

J_Y_C

    Wayfarer

  • Active Members
  • Pip
  • 80 posts

Posted 09 August 2006 - 04:10 PM

Ummm, am I daft or is there no link to a WMP UDF anywhere in this thread.....

#6 RazerM

RazerM

    cowinkeedenky - coincidence?

  • Active Members
  • PipPipPipPipPipPip
  • 1,246 posts

Posted 09 August 2006 - 04:23 PM

I want to see this also, could you post the script again please?
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

#7 WTS

WTS

    Polymath

  • Active Members
  • PipPipPipPip
  • 247 posts

Posted 09 August 2006 - 07:24 PM

I want to see this also, could you post the script again please?


it mysteriously disapeared? :whistle:

I think this is it..
WMP.au3
Plain Text         
#cs _wmpcreate($show, $left, $top, $width = 100, $height = 100) $show:  1 = shows controls         2 = hides controls Return: The object for the control #ce Func _wmpcreate($show, $left, $top, $width = 100, $height = 100) $oWMP = ObjCreate("WMPlayer.OCX") If $oWMP = 0 Then Return 0 $oWMP.settings.autoStart = "False" If $show = 1 Then     GUICtrlCreateObj($oWMP, $left, $top, $width, $height) EndIf Return $oWMP EndFunc #cs _wmploadmedia( $object, $URL, $autostart = 1 ) $object:    Object returned from the _wmpcreate() $URL:       Path or URL of the media $autostart: 1 = yes             0 = no Return: None #ce Func _wmploadmedia( $object, $URL, $autostart = 1 )     $object.URL = $URL     If $autostart = 1 And $object.controls.isAvailable("play") Then $object.controls.play() EndFunc #cs _wmpsetvalue( $object, $setting, $para=1 ) $object:    Object returned from the _wmpcreate() $setting:   "play"             "stop"             "pause"             "invisible" (Hides all)             "control"   (Shows controls)             "nocontrol" (Hides controls)             "fullscreen"             "step"      (frames to step before freezing)             "fastforward"             "fastreverse"             "volume"    (0 To 100)             "rate"      (-10 To 10)             "playcount" Return: None #ce Func _wmpsetvalue( $object, $setting, $para=1 )         Select             Case $setting = "play"             If $object.controls.isAvailable("play") Then $object.controls.play()         Case $setting = "stop"             If $object.controls.isAvailable("stop") Then $object.controls.stop()         Case $setting = "pause"             If $object.controls.isAvailable("pause") Then $object.controls.pause()         Case $setting = "invisible"             $object.uiMode = "invisible"         Case $setting = "controls"             $object.uiMode = "mini"         Case $setting = "nocontrols"             $object.uiMode = "none"         Case $setting = "fullscreen"             $object.fullscreen = "true"         Case $setting = "step"             If $object.controls.isAvailable("step") Then $object.controls.step($para)         Case $setting = "fastForward"             If $object.controls.isAvailable("fastForward") Then $object.controls.fastForward()         Case $setting = "fastReverse"             If $object.controls.isAvailable("fastReverse") Then $object.controls.fastReverse()         Case $setting = "volume"             $object.settings.volume = $para         Case $setting = "rate"             $object.settings.rate = $para         Case $setting = "playcount"             $object.settings.playCount = $para     EndSelect EndFunc



WMP_Example.au3
#include <GUIConstants.au3> #include <wmp.au3> ; == GUI generated with Koda == $Form1 = GUICreate("AForm1", 518, 439, 192, 125) $wmp = _wmpcreate(1, 8, 8, 425, 425);creates object _wmpsetvalue( $wmp, "nocontrols" );hides controls GUISetState(@SW_SHOW) _wmploadmedia( $wmp, @HomeDrive & "\WINDOWS\clock.avi" );loads media ;Sleep(1000) ;_wmpsetvalue( $wmp, "controls" );shows controls While 1     $msg = GuiGetMsg()     Select     Case $msg = $GUI_EVENT_CLOSE         ExitLoop     Case Else ;;;;;;;     EndSelect WEnd Exit

Edited by WTS, 09 August 2006 - 07:26 PM.


#8 RazerM

RazerM

    cowinkeedenky - coincidence?

  • Active Members
  • PipPipPipPipPipPip
  • 1,246 posts

Posted 09 August 2006 - 07:55 PM

Thanks
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

#9 J_Y_C

J_Y_C

    Wayfarer

  • Active Members
  • Pip
  • 80 posts

Posted 10 August 2006 - 11:59 AM

Aweso! Thanks for sharing.

#10 ConsultingJoe

ConsultingJoe

    ConsultingJoe.com

  • Active Members
  • PipPipPipPipPipPip
  • 1,667 posts

Posted 13 August 2006 - 05:20 PM

Thanks, I dono what happend

#11 Wus

Wus

    Indentured Servant

  • Active Members
  • PipPipPipPipPipPip
  • 513 posts

Posted 14 August 2006 - 05:06 AM

Nice, I will use it to hotkey WMP from games and such.

#12 BananaFredSoft

BananaFredSoft

    You will contradict this statement

  • Active Members
  • PipPipPipPipPipPip
  • 469 posts

Posted 23 July 2007 - 04:35 PM

When I try play an AVI video with this, it plays the audio but doesn't show the video, just a black square. Here is my code:
$display = _wmpcreate(1, 181, 10, 280, 210) _wmploadmedia($display, $readfrom, 0) _wmpsetvalue($display, "control")


By the way, the functions are really good! Thanks!

Edited by BananaFredSoft, 23 July 2007 - 06:45 PM.


#13 Trasy

Trasy

    Seeker

  • New Members
  • 1 posts

Posted 23 July 2007 - 11:45 PM

When I try play an AVI video with this, it plays the audio but doesn't show the video, just a black square. Here is my code:

$display = _wmpcreate(1, 181, 10, 280, 210) _wmploadmedia($display, $readfrom, 0) _wmpsetvalue($display, "control")


By the way, the functions are really good! Thanks!


Be sure $readfrom is a valid path and __wmpsetvalue($display, "control") is false, it's _wmpsetvalue($display, "controls").

#14 Tam0r

Tam0r

    Seeker

  • Active Members
  • 38 posts

Posted 27 July 2007 - 02:43 PM

http://msdn2.microsoft.com/en-us/library/bb249349.aspx

Can't one use these objects?

#15 Nahuel

Nahuel

    To Err is human, to Arr is pirate.

  • Active Members
  • PipPipPipPipPipPip
  • 1,841 posts

Posted 31 August 2007 - 03:31 AM

Why do I get this error?
Posted Image

#16 ConsultingJoe

ConsultingJoe

    ConsultingJoe.com

  • Active Members
  • PipPipPipPipPipPip
  • 1,667 posts

Posted 31 August 2007 - 05:46 AM

http://msdn2.microsoft.com/en-us/library/bb249349.aspx

Can't one use these objects?

yeah, go for it

#17 ConsultingJoe

ConsultingJoe

    ConsultingJoe.com

  • Active Members
  • PipPipPipPipPipPip
  • 1,667 posts

Posted 31 August 2007 - 05:48 AM

TO ALL: UPDATE YOUR MEDIA PLAYER

Goto help and click check for update.

#18 Nahuel

Nahuel

    To Err is human, to Arr is pirate.

  • Active Members
  • PipPipPipPipPipPip
  • 1,841 posts

Posted 31 August 2007 - 12:13 PM

Why? It only works with Wmp 11?

#19 ConsultingJoe

ConsultingJoe

    ConsultingJoe.com

  • Active Members
  • PipPipPipPipPipPip
  • 1,667 posts

Posted 31 August 2007 - 04:38 PM

Why? It only works with Wmp 11?

no, it should work with 9 and 10 too. but some functions maybe limited.

#20 mnchartier

mnchartier

    Wayfarer

  • Active Members
  • Pip
  • 60 posts

Posted 06 September 2007 - 11:31 AM

This looks very good. I did notice that you can not use the slider though to select where you want to listen from or go back to. Is there anyway to get that to work otherwise this is sweet.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users