2014-08-29 104 views
0

我嘗試通過使用進度條參考MC3190Z中的定位標籤,並​​希望一起顯示不同的進度條值。現在只使用摩托羅拉示例代碼播放聲音。但聲音只有一聲嘟嘟聲。找不到PInvoke DLL錯誤

m_LocateForm.Locate_PB.Value = tagDataArray[nIndex].LocationInfo.RelativeDistance; 

m_LocateForm.lastLocatedTagTimeStamp = System.Environment.TickCount; 

if (m_LocateForm.Locate_PB.Value >0) 
{ if (m_isBeepingEnabled) MessageBeep(MB_OK); } 

想要使它更接近標籤,所以進度條值很高,聲音應該像快速蜂鳴聲。所以標籤很遠,然後進度條很低,聲音慢慢地響起。

它是我需要把兩種類型的聲音,以顯示不同的聲音?

目前我的代碼是

[DllImport("coredll.dll")] 
internal static extern bool Beep(uint dwFreq, uint dwDuration); 

if (m_isBeepingEnabled) 
Beep(Convert.ToUInt32(m_LocateForm.Locate_PB.Value), 150); 

,但它顯示的錯誤無法找到的PInvoke DLL

回答

0

Beep isn't supported on Windows CE你可能會嘗試PlaySound

[DllImport("coredll.dll")] 
public static extern int PlaySound(
      string szSound, 
      IntPtr hModule, 
      int flags); 

與標誌下面的定義

public enum PlaySoundFlags : uint { 
    SND_SYNC = 0x0,   // play synchronously (default) 
    SND_ASYNC = 0x1,   // play asynchronously 
    SND_NODEFAULT = 0x2,  // silence (!default) if sound not found 
    SND_MEMORY = 0x4,   // pszSound points to a memory file 
    SND_LOOP = 0x8,   // loop the sound until next sndPlaySound 
    SND_NOSTOP = 0x10,   // don't stop any currently playing sound 
    SND_NOWAIT = 0x2000,  // don't wait if the driver is busy 
    SND_ALIAS = 0x10000,  // name is a registry alias 
    SND_ALIAS_ID = 0x110000,  // alias is a predefined ID 
    SND_FILENAME = 0x20000,  // name is file name 
    SND_RESOURCE = 0x40004,  // name is resource name or atom 
}; 
相關問題