2014-08-29 5 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 
}; 
관련 문제