[問題]Windows Mobile6.0上 wav無法撥放

看板C_Sharp (C#)作者 (= =+)時間13年前 (2011/11/04 14:58), 編輯推噓1(102)
留言3則, 2人參與, 最新討論串1/1
大家好, 目前正在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
有試過除錯追蹤看看程式怎麼跑嗎,在PlaySound裡設斷點
11/06 04:33, 1F

11/07 12:17, , 2F
有在Playsound後面加上messagebox,程式也可執行到那邊
11/07 12:17, 2F

11/07 12:18, , 3F
還是不知道哪邊出錯....
11/07 12:18, 3F
文章代碼(AID): #1EiuqOp7 (C_Sharp)
文章代碼(AID): #1EiuqOp7 (C_Sharp)