2.VC有没有使用PC喇叭发声的函数? The Beep function generates simple tones on the speaker. The function is synchronous; it does not return control to its caller until the sound finishes. BOOL Beep( DWORD dwFreq, // sound frequency DWORD dwDuration // sound duration );
NT系列系统下可以直接调用API,Beep() 98下: Freq是频率 __asm { push bx in al,0x61 mov bl, aL and aL, 3 jne Skip mov aL, bL or aL, 3 out 0x61, aL mov aL, 0xB6 out 0x43, aL Skip: mov ax, Freq out 0x42, aL mov aL, ah out 0x42, aL pop bx }停止用 __asm { in al,0x61; and al,0xFC; out 0x61,al; }
The Beep function generates simple tones on the speaker. The function is synchronous; it does not return control to its caller until the sound finishes. BOOL Beep(
DWORD dwFreq, // sound frequency
DWORD dwDuration // sound duration
);
98下:
Freq是频率
__asm
{
push bx
in al,0x61
mov bl, aL
and aL, 3
jne Skip
mov aL, bL
or aL, 3
out 0x61, aL
mov aL, 0xB6
out 0x43, aL
Skip: mov ax, Freq
out 0x42, aL
mov aL, ah
out 0x42, aL
pop bx
}停止用
__asm
{
in al,0x61;
and al,0xFC;
out 0x61,al;
}