Send beeps/tones to CE 4.2 scanner device

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?
 
P

Peter Foot [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top