利用WMPlayer.OCX制作音乐播放器
编辑时间:2017-03-26 作者:金满斗 浏览量:3690 来源:http://bbs.aardio.com/forum.ph

转自:http://bbs.aardio.com/forum.php?mod=viewthread&tid=9629&highlight=wmplayer

其实他这个代码还是有点小问题的,并不是所以的win机器都自带这个控件的,应该加判断的。算了。上代码吧。

import win.ui;
import com;
import fsys;
import table;
import string;
/*DSG{{*/
var winform = ..win.form( exmode="toolwindow";min=false;bottom=384;max=false;right=368;parent=...;text="aardio Form" )
winform.add( 
stop={ ah=1;bottom=42;right=208;left=165;top=7;aw=1;text="停止";z=3;cls="button" };
next={ ah=1;bottom=42;right=320;left=276;top=7;z=6;text="下一曲";aw=1;cls="button" };
previous={ ah=1;bottom=42;text="上一曲";left=221;top=7;z=5;right=265;aw=1;cls="button" };
listbox={ ah=1;bgcolor=16777215;bottom=366;top=54;right=336;left=33;vscroll=1;
items={  };z=4;aw=1;hscroll=1;edge=1;cls="listbox" };
pause={ ah=1;bottom=42;text="暂停";left=109;top=7;aw=1;right=153;z=2;cls="button" };
play={ ah=1;bottom=42;text="播放";left=47;top=7;aw=1;right=97;z=1;cls="button" }
)
/*}}*/
 
var wmp = com.CreateObject("WMPlayer.OCX");
 
//io.open();
list = {};
musiclist = {};
path = "F:/music/";
 
fsys.enum( path, "*.*",
function(dir,filename,fullpath,findData){ 
if(filename){ 
//io.print("发现文件:"+filename,"完整路径:"+fullpath)
if string.find(filename,".mp3")!=null or string.find(filename,".wav")!=null or string.find(filename,".MP3")!=null or string.find(filename,".WAV")!=null {
//io.print(filename);


来说两句吧