当前位置:编程学习 > C#/ASP.NET >>

C#实现登录时铃声播放

      请求各位大侠,我想用C#设计一款软件,在软件登录时能够播放铃声,也可以类似于人声:“欢迎使用***软件!” --------------------编程问答--------------------  Process.Start(@"E:\大海.mp3"); --------------------编程问答-------------------- System.Diagnostics.Process.Start("音乐文件路径"); --------------------编程问答-------------------- using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace LANClient
{
    class Sould
    {
        [DllImport("winmm.dll")]
        public static extern bool PlaySound(string pszSound, int hmod, int fdwSound);//播放windows音乐,重载
        public const int SND_FILENAME = 0x00020000;
        public const int SND_ASYNC = 0x0001;

        public void PlaySoundmsg()
        {
            string   msg=System.IO.Directory.GetCurrentDirectory().ToString();
            msg += "\\KongBu.wav";  
            PlaySound(msg, 0, SND_ASYNC | SND_FILENAME);
        }
      
       
        
        
    }
} --------------------编程问答--------------------
引用 2 楼 remember_me 的回复:
System.Diagnostics.Process.Start("音乐文件路径");

得加个什么控件播放?直接这样用怎么打开电脑里的播放器了 --------------------编程问答-------------------- 3楼的方法就可以呀。 --------------------编程问答--------------------
引用 3 楼 xiayit 的回复:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace LANClient
{
    class Sould
    {
        [DllImport("……


API最可靠的说 --------------------编程问答-------------------- 谢谢各位大师! --------------------编程问答-------------------- --------------------编程问答--------------------

string strMsg = "欢迎使用***软件";
new System.Speech.Synthesis.SpeechSynthesizer().SpeakAsync(strMsg);
--------------------编程问答--------------------
引用 9 楼 zaiduxinling 的回复:
C# code

string strMsg = "欢迎使用***软件";
new System.Speech.Synthesis.SpeechSynthesizer().SpeakAsync(strMsg);


这个有内存泄漏的问题。 --------------------编程问答-------------------- 3L正解,api调用最可靠
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,