sanjeev18 Posted May 4, 2011 Posted May 4, 2011 as usual all newbies in visual basic 2010 can create small media player with the help of windows media player plugin (Axwindowsmediaplayer).. they can create automatic playlist by using listbox . and double click on it to play but i am not getting what i want.. i want to make next button of windows media player enabled and workable ..someone have description of windows media player plugin ..please help me..thanks,
gunsmokingman Posted May 4, 2011 Posted May 4, 2011 I made a HTA music player using the WMP objectvar Wmp = new ActiveXObject("WMPlayer.OCX.7");For Last TrackWmp.controls.previous()For Next TrackWmp.controls.next()All you need is your Media Object name before .controls.next() or .controls.previous()
sanjeev18 Posted May 7, 2011 Author Posted May 7, 2011 thanks but can u give me its full code or souce
gunsmokingman Posted May 7, 2011 Posted May 7, 2011 My HTA player is not completed yet. I will post what I have done so far.MyHtaPlayer.hta<TITLE> « MyHtaPlayer » </TITLE><STYLE Type='text/css'> Body { Font-Size:9.25pt; Font-Weight:Bold; Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui; Color:Black; BackGround-Color:Transparent; Filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='#ece6e0',EndColorStr='#c0bab4'); Margin-Top:21; Margin-Bottom:1; Margin-Left:4; Margin-Right:4; Padding-Top:1; Padding-Bottom:1; Padding-Left:4; Padding-Right:4; Text-Align:Center; Vertical-Align:Top; Border-Top:0px Transparent; Border-Bottom:0px Transparent; Border-Left:0px Transparent; Border-Right:0px Transparent; } BUTTON { Cursor:Hand; Font-Size:8.25pt; Font-Weight:Bold; Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui; Color:#001141; Text-Align:Center; Vertical-Align:Middle; Filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='AliceBlue',endColorStr='LightSlateGray'); Border-Top:0px Transparent; Border-Bottom:0px Transparent; Border-Left:0px Transparent; Border-Right:0px Transparent; Padding-Top:0; Padding-Bottom:2; Padding-Left:0; Padding-Right:0; Margin-Top:1; Margin-Bottom:1; Margin-Left:1; Margin-Right:1; BackGround-Color:Transparent; } .Normal { Cursor:Hand; Filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='AliceBlue',endColorStr='LightSlateGray'); } .HighLight { Cursor:Hand; filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='#BAEABA',EndColorStr='#006363'); } .B1 { Height:19; Width:43; Font-Family:Webdings; Filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='AliceBlue',endColorStr='LightSlateGray'); } .B2 { Height:19; Width:43; Font-Family:Webdings; filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='#BAEABA',EndColorStr='#006363'); } TD { Font-Size:8.25pt; Font-Weight:Bold; Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui; Color:#001141; Text-Align:Center; Vertical-Align:Middle; Margin:-1; } .Menu1 { Font-Size:8.75pt; Font-Weight:Bold; Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui; filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='AliceBlue',endColorStr='LightSlateGray'); Text-Align:Left; Vertical-Align:Center; Padding-Top:1; Padding-Bottom:1; Padding-Left:2; Padding-Right:2; Border-Top:1px Solid #bbeeff; Border-Bottom:1px Solid #225588; Border-Left:1px Solid #4477aa; Border-Right:1px Solid #336699; }</STYLE><script LANGUAGE='JScript'>//-> Resize And Place In Approx center window.resizeTo(621,307) window.moveTo(screen.availWidth/2-(621/2),screen.availHeight/2-(307/2)) var Act = new ActiveXObject("Wscript.Shell"); var Fso = new ActiveXObject("Scripting.FileSystemObject"); var Wmp = new ActiveXObject("WMPlayer.OCX.7"); var CD = Act.CurrentDirectory var Tm1="";Tx1 ="";//--> Varibles For Text Output var C34 = String.fromCharCode(34); var C39 = String.fromCharCode(39); var C160 = String.fromCharCode(160); var C171 = String.fromCharCode(171); var C187 = String.fromCharCode(187); var A_r = C160+C187+C160 var A_l = C160+C171+C160 function Replaces(str, Remove, Replacer){return str.replace(Remove,Replacer);} function ExtractLeft(str,Start, Ending){return str.substring(Start , Ending);} function LCase(str){return str.toLowerCase();}// --> Body OnLoad Function window.onload=function(){ VolControl.innerHTML=MakeVolume(); Btn01.innerHTML=Btn01.innerHTML.fontsize(1.55).bold() Btn02.innerHTML=Btn02.innerHTML.fontsize(1.55).bold() Btn03.innerHTML=Btn03.innerHTML.fontsize(1.55).bold() Btn04.innerHTML=Btn04.innerHTML.fontsize(1.55).bold() Btn05.innerHTML=Btn05.innerHTML.fontsize(1.55).bold() Btn06.innerHTML=Btn06.innerHTML.fontsize(1.55).bold() }//--> Update Display Text While Music Active function MediaPlay(){ var PlayListName = Wmp.currentplaylist.name if(ExtractLeft(LCase(PlayListName),0,8)==LCase('PlayList')) {PlayListName=Rs1.all(Rs1.selectedIndex).text;} document.title = A_l + Wmp.currentMedia.name + A_r if(Wmp.PlayState==2 || Wmp.PlayState==6 || Wmp.PlayState==9 || Wmp.PlayState==11) {Tx1 = PlayListName.fontcolor("#4321da") +"<BR>"+ Wmp.currentMedia.name.fontcolor("#ad1234")+"<BR>"+ Wmp.status;} if(Wmp.PlayState==3){ Tx1 = Wmp.controls.currentPositionString +"<BR>"+ PlayListName.fontcolor("#4321da") +"<BR>"+ Wmp.currentMedia.name.fontcolor("#ad1234") +"<BR>"+ Wmp.status +"<BR>"+ Vol(Wmp.settings.volume);} if(Tm1=="") { Txt1.innerHTML = Tx1 Tm1=window.setInterval("MediaPlay()",200); } else { Txt1.innerHTML = Tx1 } }//--> Clear The Timer function Clear_1(){ window.clearInterval(Tm1);Tm1="";}//-> Build Volume Control With Mouse Events function MakeVolume(V){ var V ="";for(i = 0; i <= 100; i++) {V = V + " <Button Class='Normal' Style='Width:3pt;Margin-Left:0;'" + " OnMouseOver="+C34+ " this.className='HighLight',Vol(00"+i+"),Volume.innerHTML=Vol("+i+")"+C34+ " OnMouseOut="+C34+ " this.className='Normal',Volume.innerHTML = '';"+C34+"> </BUTTON>" }return V;}//-> Set Volome Output And Display Level text function Vol(V){ Wmp.settings.volume=V if(V==100){V=V} else if (V <= 009) {V='00'+V} else {V='0'+V} var Vt="Volume Level = "+V;return Vt}//--> Radio Selection function TestChange(){ try{if(Rs1.value=='Title'==false) Wmp.URL=(Rs1.value); if(Wmp.settings.volume <=55){Wmp.settings.volume = 55}else{Wmp.settings.volume = Wmp.settings.volume} MediaPlay();} catch(e){alert(e);}}//--> Resume Pause Button function ResumePause(){ /* Info --> Pause = Webding 4;3 Resume = Webding 314 */ if(Wmp.PlayState==3 || Wmp.PlayState==2) { if(Btn03.innerHTML=="4;3") {Btn03.innerHTML="314"; document.title = " « Rebuild Hta Music § " Wmp.controls.pause();Clear_1();MediaPlay();} else{Btn03.innerHTML="4;3";Wmp.controls.play();MediaPlay();} }else{alert("There Was No Media Playing\nSo There No Need To Pause");} }//--> Last Track Button function LastTrack(){ if(Wmp.PlayState==3 || Wmp.PlayState==2) {Wmp.controls.previous(),MediaPlay();} }//--> Next Track Button function NextTrack(){ if(Wmp.PlayState==3 || Wmp.PlayState==2) {Wmp.controls.next(),MediaPlay();} } function StopMedia(){ Wmp.controls.stop();Clear_1();Txt1.innerHTML = ""; document.title = A_l+"Rebuild Hta Music"+A_r }//--> WMP First Playlist function FIrstPlayList(){ try{Wmp.currentPlaylist = Wmp.playlistCollection.getAll().item(0);MediaPlay()} catch(e){alert("Could Not Find Any Playlists");} }</SCRIPT><BODY Scroll='No' BGProperties='Fixed'> <TABLE Style='Margin-Top:3'><TD> <DIV ID='VolControl' Style='Margin:-3;'></DIV> </TD></TABLE><!-- Volume Display Text --> <SPAN ID='Volume' Style='Width:121;position:absolute;Top:7;Left:242;'> </SPAN> <TABLE Style='Padding:5;Margin-Top:5;Vertical-Align:Top;'> <select size='1' Style='Width:205;Font-Size:8.05pt;Font-Weight:Bold;' Name='Rs1' OnChange='TestChange()'> <OPTION value="Title">Select A Radio Station</OPTION> <OPTION value="[url="http://80.94.69.106:6734/"]http://80.94.69.106:6734/">S[/url] K Y F M Classic Rock</OPTION> <OPTION value="[url="http://mfile.akamai.com/80908/live/reflector:39568.asx?bkup=50673∝=n"]http://mfile.akamai.com/80908/live/reflector:39568.asx?bkup=50673∝=n">Van[/url], BC Jack FM</OPTION> <OPTION value="[url="http://scfire-dtc-aa01.stream.aol.com:80/stream/1065"]http://scfire-dtc-aa01.stream.aol.com:80/stream/1065">Di[/url] FM Vocal Trance</OPTION> <OPTION value="[url="http://scfire-dtc-aa01.stream.aol.com:80/stream/1003"]http://scfire-dtc-aa01.stream.aol.com:80/stream/1003">Di[/url] FM Trance</OPTION> <OPTION value="[url="http://scfire-mtc-aa05.stream.aol.com:80/stream/1024"]http://scfire-mtc-aa05.stream.aol.com:80/stream/1024">Di[/url] FM Euro Dance</OPTION> <OPTION value="[url="http://72.26.204.18:6696"]http://72.26.204.18:6696">S[/url] K Y F M Rap And Hip Hop</OPTION> <OPTION value="[url="http://38.107.220.164:8054"]http://38.107.220.164:8054">181.FM[/url] The BEAT #1 HipHop</OPTION> <OPTION value="[url="http://173.193.14.170:8006"]http://173.193.14.170:8006">Big[/url] R 90's Alternative Rock</OPTION> <OPTION value="[url="http://88.191.122.121:6754"]http://88.191.122.121:6754">S[/url] K Y F M Alternative Rock</OPTION> <OPTION value="[url="http://scfire-mtc-aa05.stream.aol.com:80/stream/1076"]http://scfire-mtc-aa05.stream.aol.com:80/stream/1076">S[/url] K Y F M - All Hit 70!</OPTION> <OPTION value="[url="http://scfire-dtc-aa06.stream.aol.com:80/stream/1013"]http://scfire-dtc-aa06.stream.aol.com:80/stream/1013">S[/url] K Y F M 80`s Music</OPTION> <OPTION value="[url="http://91.121.35.252:8000/"]http://91.121.35.252:8000/">S[/url] K Y F M Oldies 50,60,70</OPTION> </SELECT><!-- Back Track--><BUTTON ID='Btn01' Class='B1' OnClick='LastTrack();' OnMouseOver="this.className='B2'" OnMouseOut="this.className='B1'" Style='Margin-Right:-2;'>313</BUTTON><!-- Next Track --> <BUTTON ID='Btn02' Class='B1' OnClick='NextTrack();' OnMouseOver="this.className='B2'" OnMouseOut="this.className='B1'" Style='Margin-Right:-2;'>414</BUTTON><!-- Pause Resume Track --> <BUTTON ID='Btn03' Class='B1' OnClick='ResumePause();' OnMouseOver="this.className='B2'" OnMouseOut="this.className='B1'" Style='Margin-Right:-2;'>4;3</BUTTON><!-- Stop Track --> <BUTTON ID='Btn04' Class='B1' OnClick='StopMedia();' OnMouseOver="this.className='B2'" OnMouseOut="this.className='B1'" Style=''>413</BUTTON><!-- Play First WMP Playlist In Media Libray --> <BUTTON ID='Btn05' OnClick='FIrstPlayList();' OnMouseOver="this.className='HighLight'" OnMouseOut="this.className=''" Style='Width:71;'>PlayList 1</BUTTON><!-- Open Up The Local media Menu --> <BUTTON ID='Btn06' OnClick='FIrstPlayList();' OnMouseOver="this.className='HighLight'" OnMouseOut="this.className=''" Style='Width:71;'>Local Media</BUTTON> </TABLE> <DIV ID='Txt1' Style='position:absolute;Top:64pt;Left:3%;Text-Align:Left;Font-Size:8.25pt;Color:#001141;Height:15pt;Width:100%;'></DIV> <DIV ID='Txt2' Style='position:absolute;Top:128pt;Left:3%;Text-Align:Left;Font-Size:8.25pt;Color:#001141;Height:15pt;Width:100%;'></DIV></BODY>MyHtaPlayer.zip
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now