Some notes on software development... RSS 2.0
# Monday, 10 March 2008

Using P/Invoke you can play a beep through the PC speaker.

The P/Invoke prototype:

[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool Beep(uint dwFreq, uint dwDuration);
Parameters:
dwFreq
specifies the frequency, in hertz, of the sound. This parameter must be in the range 37 through 32,767 (0x25 through 0x7FFF).
dwDuration specifies the duration, in milliseconds, of the sound.
Example code to call the function:
Beep(500, 1000);
Warning!!! Beep is NOT asynchronous so it does not return to the caller until the beep has finished
Links:
PInvoke.net Beep (Kernel32) reference


Monday, 10 March 2008 17:25:20 (GMT Standard Time, UTC+00:00)  #    -
C#
Navigation

Sign In
Extras
Statistics
Total Posts: 116
This Year: 0
This Month: 0
This Week: 0
Comments: 36
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2018
Hadrian Phillips

All Content © 2018, Hadrian Phillips
DasBlog theme 'Business' created by Christoph De Baene (delarou)