2014-08-29 98 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 
};