请问怎么在程序中控制系统音量大小?
网上找到的都是利用调用windows AIP播放声音,并没有找到如何控制系统音量大小,有大侠能赐教一下么,或者实现程序控制系统静音,急用,谢谢了~!
------解决方案--------------------
- C/C++ code
FUNCTION ulong auxGetDevCaps(ulong uDeviceID,ref AUXCAPS lpCaps,ulong uSize) LIBRARY "winmm.dll" ALIAS FOR "auxGetDevCapsA"FUNCTION ulong auxGetNumDevs() LIBRARY "winmm.dll"FUNCTION ulong auxGetVolume(ulong uDeviceID,ref ulong lpdwVolume) LIBRARY "winmm.dll"FUNCTION ulong auxOutMessage(ulong uDeviceID,ulong msg,ulong dw1,ulong dw2) LIBRARY "winmm.dll"FUNCTION ulong auxSetVolume(ulong uDeviceID,ulong dwVolume) LIBRARY "winmm.dll"FUNCTION ulong CloseDriver(ulong hDriver,ulong lParam1,ulong lParam2) LIBRARY "winmm.dll"FUNCTION ulong DefDriverProc(ulong dwDriverIdentifier,ulong hdrvr,ulong uMsg,ulong lParam1,ulong lParam2) LIBRARY "winmm.dll"FUNCTION ulong DrvGetModuleHandle(ulong hDriver) LIBRARY "winmm.dll"FUNCTION ulong GetDriverModuleHandle(ulong hDriver) LIBRARY "winmm.dll"FUNCTION ulong joyGetDevCaps(ulong id,ref JOYCAPS lpCaps,ulong uSize) LIBRARY "winmm.dll" ALIAS FOR "joyGetDevCapsA"FUNCTION ulong joyGetNumDevs() LIBRARY "winmm.dll" ALIAS FOR "joyGetNumDev"FUNCTION ulong joyGetPos(ulong uJoyID,ref JOYINFO pji) LIBRARY "winmm.dll"FUNCTION ulong joyGetPosEx(ulong uJoyID,ref JOYINFOEX pji) LIBRARY "winmm.dll"FUNCTION ulong joyGetThreshold(ulong id,ref ulong lpuThreshold) LIBRARY "winmm.dll"FUNCTION ulong joyReleaseCapture(ulong id) LIBRARY "winmm.dll"FUNCTION ulong joySetCapture(ulong hwnd,ulong uID,ulong uPeriod,ulong bChanged) LIBRARY "winmm.dll"FUNCTION ulong joySetThreshold(ulong id,ulong uThreshold) LIBRARY "winmm.dll" Subroutine keybd_event(Byte bVk,Byte bScan,ulong dwFlags,ulong dwExtraInfo) LIBRARY "user32.dll"FUNCTION ulong mciExecute(ref string lpstrCommand) LIBRARY "winmm.dll"FUNCTION ulong mciGetCreatorTask(ulong wDeviceID) LIBRARY "winmm.dll"FUNCTION ulong mciGetDeviceID(ref string lpstrName) LIBRARY "winmm.dll" ALIAS FOR "mciGetDeviceIDA"FUNCTION ulong mciGetDeviceIDFromElementID(ulong dwElementID,ref string lpstrType) LIBRARY "winmm.dll" ALIAS FOR "mciGetDeviceIDFromElementIDA"FUNCTION ulong mciGetErrorString(ulong dwError,ref string lpstrBuffer,ulong uLength) LIBRARY "winmm.dll" ALIAS FOR "mciGetErrorStringA"FUNCTION ulong mciGetYieldProc(ulong mciId,ref ulong pdwYieldData) LIBRARY "winmm"FUNCTION ulong mciSendCommand(ulong wDeviceID,ulong uMessage,ulong dwParam1,ulong dwParam2) LIBRARY "winmm.dll" ALIAS FOR "mciSendCommandA"FUNCTION ulong mciSendString(ref string lpstrCommand,ref string lpstrReturnString,ulong uReturnLength,ulong hwndCallback) LIBRARY "winmm.dll" ALIAS FOR "mciSendStringA"FUNCTION boolean mciSetYieldProc(ulong mciId,ulong fpYieldProc,ulong dwYieldData) LIBRARY "winmm"FUNCTION ulong midiConnect(ulong hmi,ulong hmo,ref Any pReserved) LIBRARY "winmm.dll"FUNCTION ulong midiDisconnect(ulong hmi,ulong hmo,ref Any pReserved) LIBRARY "winmm.dll"FUNCTION ulong midiInAddBuffer(ulong hMidiIn,ref MIDIHDR lpMidiInHdr,ulong uSize) LIBRARY "winmm.dll"FUNCTION ulong midiInClose(ulong hMidiIn) LIBRARY "winmm.dll"FUNCTION ulong midiInGetDevCaps(ulong uDeviceID,ref MIDIINCAPS lpCaps,ulong uSize) LIBRARY "winmm.dll" ALIAS FOR "midiInGetDevCapsA"FUNCTION ulong midiInGetErrorText(ulong err,ref string lpText,ulong uSize) LIBRARY "winmm.dll" ALIAS FOR "midiInGetErrorTextA"FUNCTION ulong midiInGetID(ulong hMidiIn,ref ulong lpuDeviceID) LIBRARY "winmm.dll"FUNCTION ulong midiInGetNumDevs() LIBRARY "winmm.dll"FUNCTION ulong midiInMessage(ulong hMidiIn,ulong msg,ulong dw1,ulong dw2) LIBRARY "winmm.dll"FUNCTION ulong midiInOpen(ref ulong lphMidiIn,ulong uDeviceID,ulong dwCallback,ulong dwInstance,ulong dwFlags) LIBRARY "winmm.dll"FUNCTION ulong midiInPrepareHeader(ulong hMidiIn,ref MIDIHDR lpMidiInHdr,ulong uSize) LIBRARY "winmm.dll"FUNCTION ulong midiInReset(ulong hMidiIn) LIBRARY "winmm.dll"FUNCTION ulong midiInStart(ulong hMidiIn) LIBRARY "winmm.dll"FUNCTION ulong midiInStop(ulong hMidiIn) LIBRARY "winmm.dll"FUNCTION ulong midiInUnprepareHeader(ulong hMidiIn,ref MIDIHDR lpMidiInHdr,ulong uSize) LIBRARY "winmm.dll"FUNCTION ulong midiOutCacheDrumPatches(ulong hMidiOut,ulong uPatch,ref ulong lpKeyArray,ulong uFlags) LIBRARY "winmm.dll"FUNCTION ulong midiOutCachePatches(ulong hMidiOut,ulong uBank,ref ulong lpPatchArray,ulong uFlags) LIBRARY "winmm.dll"FUNCTION ulong midiOutClose(ulong hMidiOut) LIBRARY "winmm.dll"FUNCTION ulong midiOutGetDevCaps(ulong uDeviceID,ref MIDIOUTCAPS lpCaps,ulong uSize) LIBRARY "winmm.dll" ALIAS FOR "midiOutGetDevCapsA"FUNCTION ulong midiOutGetErrorText(ulong err,ref string lpText,ulong uSize) LIBRARY "winmm.dll" ALIAS FOR "midiOutGetErrorTextA"FUNCTION ulong midiOutGetID(ulong hMidiOut,ref ulong lpuDeviceID) LIBRARY "winmm.dll"FUNCTION Integer midiOutGetNumDevs() LIBRARY "winmm"FUNCTION ulong midiOutGetVolume(ulong uDeviceID,ref ulong lpdwVolume) LIBRARY "winmm.dll"FUNCTION ulong midiOutLongMsg(ulong hMidiOut,ref MIDIHDR lpMidiOutHdr,ulong uSize) LIBRARY "winmm.dll"FUNCTION ulong midiOutMessage(ulong hMidiOut,ulong msg,ulong dw1,ulong dw2) LIBRARY "winmm.dll"FUNCTION ulong midiOutOpen(ref ulong lphMidiOut,ulong uDeviceID,ulong dwCallback,ulong dwInstance,ulong dwFlags) LIBRARY "winmm.dll"FUNCTION ulong midiOutPrepareHeader(ulong hMidiOut,ref MIDIHDR lpMidiOutHdr,ulong uSize) LIBRARY "winmm.dll"FUNCTION ulong midiOutReset(ulong hMidiOut) LIBRARY "winmm.dll"FUNCTION ulong midiOutSetVolume(ulong uDeviceID,ulong dwVolume) LIBRARY "winmm.dll"FUNCTION ulong midiOutShortMsg(ulong hMidiOut,ulong dwMsg) LIBRARY "winmm.dll"FUNCTION ulong midiOutUnprepareHeader(ulong hMidiOut,ref MIDIHDR lpMidiOutHdr,ulong uSize) LIBRARY "winmm.dll"FUNCTION ulong midiStreamClose(ulong hms) LIBRARY "winmm.dll"FUNCTION ulong midiStreamOpen(ref ulong phms,ref ulong puDeviceID,ulong cMidi,ulong dwCallback,ulong dwInstance,ulong fdwOpen) LIBRARY "winmm.dll"FUNCTION ulong midiStreamOut(ulong hms,ref MIDIHDR pmh,ulong cbmh) LIBRARY "winmm.dll"FUNCTION ulong midiStreamPause(ulong hms) LIBRARY "winmm.dll"FUNCTION ulong midiStreamPosition(ulong hms,ref MMTIME lpmmt,ulong cbmmt) LIBRARY "winmm.dll"FUNCTION ulong midiStreamProperty(ulong hms,ref Byte lppropdata,ulong dwProperty) LIBRARY "winmm.dll"FUNCTION ulong midiStreamRestart(ulong hms) LIBRARY "winmm.dll"FUNCTION ulong midiStreamStop(ulong hms) LIBRARY "winmm.dll"