Send beeps/tones to CE 4.2 scanner device

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

How can I tell the windows mobile CE 4.2 device to raise a certain beep
tone. Is this possible? When the user is scanning bar codes, they may not
be looking at the screen for errors. I'd like to raise an "Error" tone so
the user can audibly hear there was an input error and then look on to the
display for intructions. Has anyone tried this?
 
You can P/Invoke MessageBeep (see the SDK for details) to play default beep
noises, or PlaySound to play any .wav file. There are also third-party
wrapper classes, I wrote SystemSounds and SoundPlayer classes for .NETCF
which appear in Mobile In The Hand
(http://inthehand.com/content/Mobile.aspx) and elsewhere. The P/Invokes are
below:-

[DllImport("coredll.dll", EntryPoint="MessageBeep", SetLastError=true)]
private static extern void MessageBeep(int type);

usage:-

MessageBeep(0);


[DllImport("coredll.dll", EntryPoint="PlaySoundW", SetLastError=true) ]
private extern static bool PlaySound(string lpszName, IntPtr hModule, int
dwFlags);

usage:-

PlaySound("\\windows\\mywav.wav", IntPtr.Zero, 0x20000);

Peter
 
Back
Top