How to enable Windows Mobile speakers

Source: Internet
Author: User

# 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;
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.