# Include <windows. h>
# Define ctl_code (devicetype, function, method, access )(/
(Devicetype) <16) | (ACCESS) <14) | (function) <2) | (method )/
)
# Define method_buffered 0
# Define file_any_access 0
# Define file_device_speaker 32770
# Define ioctl_speaker_add_policy_hwnd ctl_code (file_device_speaker, 2052, method_buffered, file_any_access)
# Define ioctl_speaker_remove_policy_hwnd ctl_code (file_device_speaker, 2053, method_buffered, file_any_access)
# Define ioctl_speaker_getmode ctl_code (file_device_speaker, 2054, method_buffered, file_any_access)
# Define ioctl_speaker_setmode ctl_code (file_device_speaker, 2055, method_buffered, file_any_access)
Int winapi winmain (hinstance,
Hinstance hprevinstance,
Lptstr lpcmdline,
Int ncmdshow)
{
Handle hspk = createfile (text ("spk1:"), 0, 0, null, open_existing, 0, null );
If (invalid_handle_value! = Hspk)
{
DWORD dwspkmode = true;
Deviceiocontrol (hspk, ioctl_speaker_setmode, & dwspkmode, sizeof (dwspkmode), null, 0, null, null );
Closehandle (hspk );
}
Return 0;
}