[問題]Windows Mobile6.0上 wav無法撥放
大家好, 目前正在6.0手機上開發專案 .NET Framework 為2.0
程式是寫成當訊息傳送到手機時會有提醒音效
爬了許多文跟看了資料後, 知道要使用CoreDll.dll檔
因無法在方案總管直接加入參考,故使用DllImport("CoreDll.dll")的方法
但還是失敗....希望板上的前輩可幫忙看看是哪裡有問題 > <
程式碼如下
public const UInt32 SND_SYNC = 0x00000000;
public const UInt32 SND_FILENAME = 0x00020000;
public const UInt32 SND_ASYNC = 0x00000001;
public const UInt32 SND_RESOURCE = 0x00040004;
[DllImport("CoreDll.dll",
CallingConvention = CallingConvention.Winapi,
CharSet = CharSet.Unicode,
EntryPoint = "PlaySound",
PreserveSig = true,
SetLastError = false)]
public extern static bool PlaySound(String pszSound, IntPtr hmod,
UInt32 fdwSound);
string a="Program Files\\SoundSample\\DOG04.WAV";
//string a = "DOG04.WAV";
private void button1_Click(object sender, EventArgs e)
{
//前面為判斷有無訊息的判斷式,之後就call PlaySound
PlaySound(a, IntPtr.Zero, SND_ASYNC | SND_FILENAME);
}
程式可在手機上執行, 訊息也傳成功, 但就是沒有音效
是否跟路徑有關? 也試過直接讀取檔名(使用SND_RESOURCE) 但都不成功.....
謝謝指教!!!! 麻煩了!!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 120.108.205.57
推
11/06 04:33, , 1F
11/06 04:33, 1F
→
11/07 12:17, , 2F
11/07 12:17, 2F
→
11/07 12:18, , 3F
11/07 12:18, 3F
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章