怎样使用microsoft media player控件? 怎样使用microsoft media player控件? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在 Visual Basic .NET 应用程序中播放数字媒体 http://www.microsoft.com/china/msdn/archives/library/dnwmt/html/VB_Player_article.asp你可以参考一下 <html><head><title>在线音乐</title><META HTTP-EQUIV="Content-Type" Content="text/html; charset=GB2312"></head><body leftmargin="0" topmargin="0" style="border:2px solid #ee3333"><div align="center"><OBJECT ID="Player" CLASSID="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" WIDTH=400 HEIGHT=420> <PARAM name="autoStart" value="True"> <PARAM NAME="ShowDisplay" VALUE="True"> <param name="AudioStream" value="-1"> <param name="AutoSize" value="-1"> <param name="AnimationAtStart" value="-1"> <param name="AllowScan" value="-1"> <PARAM NAME="AllowShuffle" VALUE="Yes"> <param name="AllowChangeDisplaySize" value="-1"> <param name="AutoRewind" value="-1"> <param name="Balance" value="-1"> <param name="BaseURL" value=""> <param name="BufferingTime" value="5"> <param name="CaptioningID" value=""> <param name="ClickToPlay" value="-1"> <param name="CursorType" value="0"> <param name="CurrentPosition" value="-1"> <param name="CurrentMarker" value="-1"> <param name="DefaultFrame" value="_blank"> <param name="DisplayBackColor" value="-1"> <param name="DisplayForeColor" value="16777215"> <param name="DisplayMode" value="-1"> <param name="DisplaySize" value="-1"> <param name="Enabled" value="-1"> <param name="EnableContextMenu" value="-1"> <param name="EnablePositionControls" value="-1"> <param name="EnableFullScreenControls" value="-1"> <param name="EnableTracker" value="-1"> <param name="Filename" value="http://dotnet.aspx.cc/Play.asx"> <param name="url" value="http://dotnet.aspx.cc/Play.asx"> <param name="InvokeURLs" value="False"> <param name="Language" value="-1"> <param name="Mute" value="0"> <param name="PlayCount" value="1000"> <param name="PreviewMode" value="-1"> <param name="Rate" value="1"> <param name="SAMILang" value=""> <param name="SAMIStyle" value=""> <param name="SAMIFileName" value=""> <param name="SelectionStart" value="-1"> <param name="SelectionEnd" value="-1"> <param name="SendOpenStateChangeEvents" value="-1"> <param name="SendWarningEvents" value="-1"> <param name="SendErrorEvents" value="-1"> <param name="SendKeyboardEvents" value="0"> <param name="SendMouseClickEvents" value="0"> <param name="SendMouseMoveEvents" value="-1"> <param name="SendPlayStateChangeEvents" value="-1"> <param name="ShowCaptioning" value="0"> <param name="ShowControls" value="-1"> <param name="ShowAudioControls" value="-1"> <param name="ShowGotoBar" value="-1"> <param name="ShowPositionControls" value="-1"> <param name="ShowStatusBar" value="-1"> <param name="ShowTracker" value="-1"> <param name="TransparentAtStart" value="-1"> <param name="VideoBorderWidth" value="-1"> <param name="VideoBorderColor" value="-1"> <param name="VideoBorder3D" value="1"> <param name="Volume" value="100"> <param name="windowlessVideo" value="true"> <embed type="application/x-mplayer2" filename="http://dotnet.aspx.cc/Play.asx" src="http://dotnet.aspx.cc/Play.asx" showcontrols=0 showdisplay=0 showstatusbar=0 audiostream="-1" autosize="-1" autostart="-1" animationatstart="-1" allowscan="-1" allowchangedisplaysize="-1" autorewind="0" balance="0" baseurl="" bufferingtime="5" captioningid="" clicktoplay="0" cursortype="0" currentposition="-1" currenter="0" defaultframe="" displaybackcolor="0" displayforecolor="16777215" displaymode="0" displaysize="0" enabled="-1" enablecontextmenu="-1" enablepositioncontrols="-1" enablefullscreencontrols="0" enabletracker="-1" invokeurls="-1" language="-1" mute="0" playcount="1" previewmode="0" rate="1" samilang="" samistyle="" samifilename="" selectionstart="-1" selectionend="-1" sendopenstatechangeevents="-1" sendwarningevents="-1" senderrorevents="-1" sendkeyboardevents="0" sendmouseclickevents="0" sendmousemoveevents="-1" sendplaystatechangeevents="-1" showcaptioning="0" showaudiocontrols="0" showgotobar="0" showpositioncontrols="0" showtracker="0" transparentatstart="0" videoborderwidth="0" videobordercolor="0" videoborder3d="0" volume="-100" windowlessvideo="0"> </embed></object></div><div style="padding:3px;line-height:12pt" align="center">你也可以把下面的地址拷贝到Media Player的“文件”-“打开URL”里:<br><b>http://dotnet.aspx.cc/Play.asx</b></div> 工具--添加/移除工具箱选com组件找到windows media play加入就可以加到工具箱里了,从工具箱上把这个控件拖到页面后进入.aspx文件修改为<PARAM NAME="URL" VALUE='<%=Session["fileName"]%>'>在命令中修改Session["fileName"]="k:\\abc.mpg";就可以了 傻傻地问:http://dotnet.aspx.cc/Play.asx中的Play.asx 怎么控制音乐播放的文件,或者循环播放给点例子也行啊,谢谢! 来凑热闹播放声音using System;using System.Runtime.InteropServices;class musicplay{[DllImport("winmm.dll")]private static extern long mciSendString(string lpstrCommand,string lpstrReturnString,long length,long hwndcallback);public musicplay(string name){ filename=name; }public void play(){ t=mciSendString(@"open " + filename,m,0,0); t=mciSendString(@"play " + filename + @" wait",m,0,0); t=mciSendString(@"close " + filename,m,0,0);}private string filename;private string m=@" ";private long t;} class test{ static void Main(){ Console.WriteLine("请输入你要播放的歌曲的路径"); musicplay mpl=new musicplay(Console.ReadLine()); mpl.play(); Console.WriteLine("播放完毕,再见"); } }================================================================================================public class Form1 : System.Windows.Forms.Form { double shu; double temps1; double temps2; double jg; double save; double zf; string js; bool gl; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button5; private System.Windows.Forms.Button button6; private System.Windows.Forms.Button button7; private System.Windows.Forms.Button button8; private System.Windows.Forms.Button button9; private System.Windows.Forms.Button button10; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Button button11; private System.Windows.Forms.Button button12; private System.Windows.Forms.Button button13; private System.Windows.Forms.Button button14; private System.Windows.Forms.Button button15; private System.Windows.Forms.Button button16; private System.Windows.Forms.Button button17; private System.Windows.Forms.Button button18; private System.Windows.Forms.Button button19; private System.Windows.Forms.Button button20; private System.Windows.Forms.Button button21; private System.Windows.Forms.Button button22; private System.Windows.Forms.Button button23; [DllImport("winmm.dll", EntryPoint="PlaySound")] public static extern bool PlaySound(ref Byte snd, IntPtr hmod, uint fdwSound); [DllImport("winmm.dll", EntryPoint="PlaySound")] public static extern int PlaySound(string lpszName,int hModule,int dwFlags); public enum PlayingFlags :uint { SND_SYNC = 0x00, SND_ASYNC = 0x01, SND_NODEFAULT = 0x02, SND_MEMORY = 0x04, SND_ALIAS = 0x010000, SND_FILENAME = 0x020000, SND_RESOURCE = 0x040004, SND_ALIAS_ID = 0x0110000, SND_ALIAS_START = 0, SND_LOOP = 0x08, SND_NOSTOP = 0x010, SND_VALID = 0x01F, SND_NOWAIT = 0x02000, SND_PURGE = 0x40 }...................................................省略private void button1_Click(object sender, System.EventArgs e) { Form1.PlaySound(filename.wav,0,(int)Form1.PlayingFlags.SND_SYNC); Button btn=(Button) sender; if (gl) { textBox1.Text=btn.Text; gl=false; } else if (textBox1.Text=="0") { textBox1.Text=btn.Text; gl=false; } else { textBox1.Text=textBox1.Text+btn.Text; gl=false; } shu = Convert.ToDouble(textBox1.Text); } 同时存在于........的问题 web页面使用activex问题 表单提交问题 删除treeview子节点后刷新tree如何展开删除的节点的父节点 一个奇怪的问题 关于Web service的奇怪问题。 知道的进来看看 *****Datalist二层嵌套事件问题? aspx页面怎么关闭自己 DataGrid翻页问题!在线等待! SESSION使用问题 使用iewc toolbar按钮触发导出excel时出错
http://www.microsoft.com/china/msdn/archives/library/dnwmt/html/VB_Player_article.asp
你可以参考一下
<head>
<title>在线音乐</title>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=GB2312">
</head>
<body leftmargin="0" topmargin="0" style="border:2px solid #ee3333">
<div align="center">
<OBJECT ID="Player" CLASSID="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" WIDTH=400 HEIGHT=420>
<PARAM name="autoStart" value="True">
<PARAM NAME="ShowDisplay" VALUE="True">
<param name="AudioStream" value="-1">
<param name="AutoSize" value="-1">
<param name="AnimationAtStart" value="-1">
<param name="AllowScan" value="-1">
<PARAM NAME="AllowShuffle" VALUE="Yes">
<param name="AllowChangeDisplaySize" value="-1">
<param name="AutoRewind" value="-1">
<param name="Balance" value="-1">
<param name="BaseURL" value="">
<param name="BufferingTime" value="5">
<param name="CaptioningID" value="">
<param name="ClickToPlay" value="-1">
<param name="CursorType" value="0">
<param name="CurrentPosition" value="-1">
<param name="CurrentMarker" value="-1">
<param name="DefaultFrame" value="_blank">
<param name="DisplayBackColor" value="-1">
<param name="DisplayForeColor" value="16777215">
<param name="DisplayMode" value="-1">
<param name="DisplaySize" value="-1">
<param name="Enabled" value="-1">
<param name="EnableContextMenu" value="-1">
<param name="EnablePositionControls" value="-1">
<param name="EnableFullScreenControls" value="-1">
<param name="EnableTracker" value="-1">
<param name="Filename" value="http://dotnet.aspx.cc/Play.asx">
<param name="url" value="http://dotnet.aspx.cc/Play.asx">
<param name="InvokeURLs" value="False">
<param name="Language" value="-1">
<param name="Mute" value="0">
<param name="PlayCount" value="1000">
<param name="PreviewMode" value="-1">
<param name="Rate" value="1">
<param name="SAMILang" value="">
<param name="SAMIStyle" value="">
<param name="SAMIFileName" value="">
<param name="SelectionStart" value="-1">
<param name="SelectionEnd" value="-1">
<param name="SendOpenStateChangeEvents" value="-1">
<param name="SendWarningEvents" value="-1">
<param name="SendErrorEvents" value="-1">
<param name="SendKeyboardEvents" value="0">
<param name="SendMouseClickEvents" value="0">
<param name="SendMouseMoveEvents" value="-1">
<param name="SendPlayStateChangeEvents" value="-1">
<param name="ShowCaptioning" value="0">
<param name="ShowControls" value="-1">
<param name="ShowAudioControls" value="-1">
<param name="ShowGotoBar" value="-1">
<param name="ShowPositionControls" value="-1">
<param name="ShowStatusBar" value="-1">
<param name="ShowTracker" value="-1">
<param name="TransparentAtStart" value="-1">
<param name="VideoBorderWidth" value="-1">
<param name="VideoBorderColor" value="-1">
<param name="VideoBorder3D" value="1">
<param name="Volume" value="100">
<param name="windowlessVideo" value="true">
<embed type="application/x-mplayer2" filename="http://dotnet.aspx.cc/Play.asx" src="http://dotnet.aspx.cc/Play.asx" showcontrols=0 showdisplay=0 showstatusbar=0
audiostream="-1" autosize="-1" autostart="-1" animationatstart="-1" allowscan="-1" allowchangedisplaysize="-1" autorewind="0" balance="0" baseurl="" bufferingtime="5" captioningid="" clicktoplay="0" cursortype="0" currentposition="-1" currenter="0" defaultframe="" displaybackcolor="0" displayforecolor="16777215" displaymode="0" displaysize="0" enabled="-1" enablecontextmenu="-1" enablepositioncontrols="-1" enablefullscreencontrols="0" enabletracker="-1" invokeurls="-1" language="-1" mute="0" playcount="1" previewmode="0" rate="1" samilang="" samistyle="" samifilename="" selectionstart="-1" selectionend="-1" sendopenstatechangeevents="-1" sendwarningevents="-1" senderrorevents="-1" sendkeyboardevents="0" sendmouseclickevents="0" sendmousemoveevents="-1" sendplaystatechangeevents="-1" showcaptioning="0" showaudiocontrols="0" showgotobar="0" showpositioncontrols="0" showtracker="0" transparentatstart="0" videoborderwidth="0" videobordercolor="0" videoborder3d="0" volume="-100" windowlessvideo="0">
</embed>
</object>
</div>
<div style="padding:3px;line-height:12pt" align="center">
你也可以把下面的地址拷贝到Media Player的“文件”-“打开URL”里:<br>
<b>http://dotnet.aspx.cc/Play.asx</b>
</div>
从工具箱上把这个控件拖到页面后进入.aspx文件修改为<PARAM NAME="URL" VALUE='<%=Session["fileName"]%>'>在命令中修改Session["fileName"]="k:\\abc.mpg";
就可以了
给点例子也行啊,谢谢!
播放声音
using System;
using System.Runtime.InteropServices;class musicplay{
[DllImport("winmm.dll")]
private static extern long mciSendString(string lpstrCommand,string lpstrReturnString,long length,long hwndcallback);
public musicplay(string name){
filename=name;
}
public void play(){
t=mciSendString(@"open " + filename,m,0,0);
t=mciSendString(@"play " + filename + @" wait",m,0,0);
t=mciSendString(@"close " + filename,m,0,0);
}
private string filename;
private string m=@" ";
private long t;
}
class test{
static void Main(){
Console.WriteLine("请输入你要播放的歌曲的路径");
musicplay mpl=new musicplay(Console.ReadLine());
mpl.play();
Console.WriteLine("播放完毕,再见"); }
}================================================================================================
public class Form1 : System.Windows.Forms.Form
{
double shu;
double temps1;
double temps2;
double jg;
double save;
double zf;
string js;
bool gl;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.Button button9;
private System.Windows.Forms.Button button10;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button11;
private System.Windows.Forms.Button button12;
private System.Windows.Forms.Button button13;
private System.Windows.Forms.Button button14;
private System.Windows.Forms.Button button15;
private System.Windows.Forms.Button button16;
private System.Windows.Forms.Button button17;
private System.Windows.Forms.Button button18;
private System.Windows.Forms.Button button19;
private System.Windows.Forms.Button button20;
private System.Windows.Forms.Button button21;
private System.Windows.Forms.Button button22;
private System.Windows.Forms.Button button23; [DllImport("winmm.dll", EntryPoint="PlaySound")]
public static extern bool PlaySound(ref Byte snd, IntPtr hmod, uint fdwSound);
[DllImport("winmm.dll", EntryPoint="PlaySound")]
public static extern int PlaySound(string lpszName,int hModule,int dwFlags); public enum PlayingFlags :uint
{
SND_SYNC = 0x00,
SND_ASYNC = 0x01,
SND_NODEFAULT = 0x02,
SND_MEMORY = 0x04,
SND_ALIAS = 0x010000,
SND_FILENAME = 0x020000,
SND_RESOURCE = 0x040004,
SND_ALIAS_ID = 0x0110000,
SND_ALIAS_START = 0,
SND_LOOP = 0x08,
SND_NOSTOP = 0x010,
SND_VALID = 0x01F,
SND_NOWAIT = 0x02000,
SND_PURGE = 0x40
}
...................................................省略
private void button1_Click(object sender, System.EventArgs e)
{
Form1.PlaySound(filename.wav,0,(int)Form1.PlayingFlags.SND_SYNC);
Button btn=(Button) sender;
if (gl)
{
textBox1.Text=btn.Text;
gl=false;
}
else if (textBox1.Text=="0")
{
textBox1.Text=btn.Text;
gl=false;
}
else
{
textBox1.Text=textBox1.Text+btn.Text;
gl=false;
}
shu = Convert.ToDouble(textBox1.Text);
}