WinMe和Win9x是一样的,用beep确实不行。
Win9x/me下可以这样:
procedure TMainForm.sound(mhz: integer); {mhz = the frequency of the pc speakerPC喇叭发声,只适用于Win9X}
var
count : word;
begin
try
count := 1193280 div mhz;
asm
mov al,$b6
out $43,al
mov ax,count
out $42,al
mov al,ah
out $42,al
mov al,3
out $61,al
end;
except
;
end;
end;
procedure TMainForm.nosound; {turn off the pc speaker关闭PC喇叭,只适用于Win9X}
begin
asm
mov al,0
out $61,al
end;
end;
//但在Win2k下windows.beep(2000,200); 绝对可行。