VISUAL C#系列
Posted on | 四月 11, 2010 | 1 Comment
private void button2_Click(object sender, EventArgs e)
{//获取Cmd命令行窗口中显示的内容
Process MyProcess = new Process();
//设定程序名
MyProcess.StartInfo.FileName = “cmd.exe”;
//关闭Shell的使用
MyProcess.StartInfo.UseShellExecute = false;
//重定向标准输入
MyProcess.StartInfo.RedirectStandardInput = true;
//重定向标准输出
MyProcess.StartInfo.RedirectStandardOutput = true;
//重定向错误输出
MyProcess.StartInfo.RedirectStandardError = true;
//设置不显示窗口
MyProcess.StartInfo.CreateNoWindow = true;
//执行DOS命令
MyProcess.Start();
MyProcess.StandardInput.WriteLine(“Dir C:\\”);
MyProcess.StandardInput.WriteLine(“exit”);
//从输出流获取命令执行结果,
string MyInfo = MyProcess.StandardOutput.ReadToEnd();
MessageBox.Show(MyInfo, “信息提示”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void button3_Click(object sender, EventArgs e)
{//同步加载并播放声音文件
SoundPlayer MyPlayer= new SoundPlayer();
string MyFileName = Application.StartupPath + “\\WindowsXPStart.wav“;
MyPlayer.SoundLocation = MyFileName;
MyPlayer.Load();
MyPlayer.PlaySync();
}
private void button4_Click(object sender, EventArgs e)
{//异步加载并播放声音文件
SoundPlayer MyPlayer = new SoundPlayer();
string MyFileName = Application.StartupPath + “\\WindowsXPStart.wav“;
MyPlayer.SoundLocation = MyFileName;
MyPlayer.LoadAsync();
MyPlayer.Play();
}
相关文章:
评论|Comments
One Response to “VISUAL C#系列”
留言|Leave a Reply
![如果您自认为是一位忠实的Silverlight-Fans,那么请将此标志放到您的博客中成为一名真正的[银光使者]](http://images.cnblogs.com/cnblogs_com/alamiye010/Silverlighter1.jpg)
五月 2nd, 2010 @ 11:05
/************************************************
* Left Sidebar *
************************************************/
#l_sidebar {
float: right;
width: 203px;
margin: 40px 0px 0px 0px;
padding: 0px 19px 20px 19px;
border-left: 1px solid #E2DDDE;
font:11px/18px Verdana, Arial, Helvetica, sans-serif;
}
#l_sidebar ul {
list-style: none;
margin: 0px;
padding: 0px;
}
#l_sidebar ul li {
background:transparent url(“images/bullet.gif”) 0px 11px no-repeat; /* 0px = horizontal position for left, 6px = vertical position from top */
display: block;
padding: 4px 0px 4px 10px;
margin: 0px;
}
#l_sidebar a:link, #l_sidebar a:visited { color:#444; text-decoration:none; outline:none; }
#l_sidebar a:hover, #l_sidebar a:active { color:#444; text-decoration:underline; outline:none; }
#l_sidebar p{
padding: 3px 0px 0px 0px;
margin: 0px;
line-height: 20px;
}
#l_sidebar li {list-style: none; }