xbbin
asked on
How to turn on/off the pc speaker in W2K?
Hi all,
This codes work fine with win98, but can't work with Win2000, How to change it? (Please don't just tell me a component, I need the source)
if BeepOn then //BeepOn is a logic flag
begin
asm
mov al,3 //turn on the pc speaker
out $61,al
mov al,$0B6
out $43,al
mov al,200
out $42,al
mov al,20
out $42,al
end;
end
else
begin
asm
mov al,0 //turn off the pc speaker
out $61,al
end;
end;
This codes work fine with win98, but can't work with Win2000, How to change it? (Please don't just tell me a component, I need the source)
if BeepOn then //BeepOn is a logic flag
begin
asm
mov al,3 //turn on the pc speaker
out $61,al
mov al,$0B6
out $43,al
mov al,200
out $42,al
mov al,20
out $42,al
end;
end
else
begin
asm
mov al,0 //turn off the pc speaker
out $61,al
end;
end;
ASKER
Hi,
I just want to turn on/off the pc speaker, How to do that without assembly code?
I just want to turn on/off the pc speaker, How to do that without assembly code?
Try this:
// Disable Enable:
procedure TForm1.Button1Click(Sender : TObject);
begin
SystemParametersInfo(SPI_S ETBEEP,0,N IL,SPIF_SE NDWININICH ANGE);
end;
// Enable Beep:
procedure TForm1.Button2Click(Sender : TObject);
begin
SystemParametersInfo(SPI_S ETBEEP,1,N IL,SPIF_SE NDWININICH ANGE);
end;
tas
// Disable Enable:
procedure TForm1.Button1Click(Sender
begin
SystemParametersInfo(SPI_S
end;
// Enable Beep:
procedure TForm1.Button2Click(Sender
begin
SystemParametersInfo(SPI_S
end;
tas
ASKER
Hi Tasomia,
Not have any sound at all.
Not have any sound at all.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi freshman,
Why can't install it on Delphi3? The compiler say: SERVICE_KERNEL_DRIVER, SERVICE_DEMAND_START and SERVICE_ERROR_NORMAL are undeclared identifier.
(Should I need to declared some unit on the "use" section??)
Delphi4 not have this problem.
Regards, bin
Why can't install it on Delphi3? The compiler say: SERVICE_KERNEL_DRIVER, SERVICE_DEMAND_START and SERVICE_ERROR_NORMAL are undeclared identifier.
(Should I need to declared some unit on the "use" section??)
Delphi4 not have this problem.
Regards, bin
Hello bin,
Try Putting 'WinSvc.pas' unit in the implementation's uses
Try Putting 'WinSvc.pas' unit in the implementation's uses
I think you can't do that with win2000/xp, cuz it's not allowed you to direct access the hardware
the code which using assemply with ports, doesn't work in any version based on NT, i'm not sure with that also with the PC speaker, but i think it's the same cuz u r using assembly code to access the hardware