Solved

volume control like small speaker icon

Posted on 1998-12-09
7
331 Views
Last Modified: 2008-02-20
I need a volume control in my app to control the main volume the same as when the small speaker icon is clicked on taskbar.
 What code do I need.
0
Comment
Question by:fred12
  • 4
  • 3
7 Comments
 

Author Comment

by:fred12
Comment Utility
Edited text of question
0
 

Expert Comment

by:fury
Comment Utility
Edited text of question
0
 

Accepted Solution

by:
fury earned 50 total points
Comment Utility
You need an API function and a slider.
I will tell u the code tonight. I am in the office now...
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:fred12
Comment Utility
'-------Module---------
Option Explicit

Public Const MAXPNAMELEN = 32
Public Const MIXER_SHORT_NAME_CHARS = 16
Public Const MIXER_LONG_NAME_CHARS = 64

Public Const MIXER_OBJECTF_AUX = &H50000000
Public Const MIXER_OBJECTF_HANDLE = &H80000000
Public Const MIXER_OBJECTF_MIXER = &H0&
Public Const MIXER_OBJECTF_WAVEIN = &H20000000
Public Const MIXER_OBJECTF_WAVEOUT = &H10000000
Public Const MIXER_OBJECTF_HMIXER = (MIXER_OBJECTF_HANDLE Or MIXER_OBJECTF_MIXER)
Public Const MIXER_OBJECTF_HWAVEIN = (MIXER_OBJECTF_HANDLE Or MIXER_OBJECTF_WAVEIN)
Public Const MIXER_OBJECTF_HWAVEOUT = (MIXER_OBJECTF_HANDLE Or MIXER_OBJECTF_WAVEOUT)

Public Const MIXERCONTROL_CT_CLASS_CUSTOM = &H0&
Public Const MIXERCONTROL_CT_CLASS_FADER = &H50000000
Public Const MIXERCONTROL_CT_CLASS_LIST = &H70000000
Public Const MIXERCONTROL_CT_CLASS_MASK = &HF0000000
Public Const MIXERCONTROL_CT_CLASS_METER = &H10000000
Public Const MIXERCONTROL_CT_CLASS_NUMBER = &H30000000
Public Const MIXERCONTROL_CT_CLASS_SLIDER = &H40000000
Public Const MIXERCONTROL_CT_CLASS_SWITCH = &H20000000
Public Const MIXERCONTROL_CT_CLASS_TIME = &H60000000
Public Const MIXERCONTROL_CT_UNITS_BOOLEAN = &H10000
Public Const MIXERCONTROL_CT_UNITS_CUSTOM = &H0&
Public Const MIXERCONTROL_CT_UNITS_DECIBELS = &H40000
Public Const MIXERCONTROL_CT_UNITS_MASK = &HFF0000
Public Const MIXERCONTROL_CT_UNITS_PERCENT = &H50000
Public Const MIXERCONTROL_CT_UNITS_SIGNED = &H20000
Public Const MIXERCONTROL_CT_UNITS_UNSIGNED = &H30000
Public Const MIXERCONTROL_CT_SC_LIST_MULTIPLE = &H1000000
Public Const MIXERCONTROL_CT_SC_LIST_SINGLE = &H0&
Public Const MIXERCONTROL_CT_SC_METER_POLLED = &H0&
Public Const MIXERCONTROL_CT_SC_SWITCH_BOOLEAN = &H0&
Public Const MIXERCONTROL_CT_SC_SWITCH_BUTTON = &H1000000
Public Const MIXERCONTROL_CT_SC_TIME_MICROSECS = &H0&
Public Const MIXERCONTROL_CT_SC_TIME_MILLISECS = &H1000000

Public Const MIXERCONTROL_CONTROLTYPE_FADER = (MIXERCONTROL_CT_CLASS_FADER Or MIXERCONTROL_CT_UNITS_UNSIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_BASS = (MIXERCONTROL_CONTROLTYPE_FADER + 2)
Public Const MIXERCONTROL_CONTROLTYPE_BOOLEAN = (MIXERCONTROL_CT_CLASS_SWITCH Or MIXERCONTROL_CT_SC_SWITCH_BOOLEAN Or MIXERCONTROL_CT_UNITS_BOOLEAN)
Public Const MIXERCONTROL_CONTROLTYPE_BOOLEANMETER = (MIXERCONTROL_CT_CLASS_METER Or MIXERCONTROL_CT_SC_METER_POLLED Or MIXERCONTROL_CT_UNITS_BOOLEAN)
Public Const MIXERCONTROL_CONTROLTYPE_BUTTON = (MIXERCONTROL_CT_CLASS_SWITCH Or MIXERCONTROL_CT_SC_SWITCH_BUTTON Or MIXERCONTROL_CT_UNITS_BOOLEAN)
Public Const MIXERCONTROL_CONTROLTYPE_CUSTOM = (MIXERCONTROL_CT_CLASS_CUSTOM Or MIXERCONTROL_CT_UNITS_CUSTOM)
Public Const MIXERCONTROL_CONTROLTYPE_DECIBELS = (MIXERCONTROL_CT_CLASS_NUMBER Or MIXERCONTROL_CT_UNITS_DECIBELS)
Public Const MIXERCONTROL_CONTROLTYPE_EQUALIZER = (MIXERCONTROL_CONTROLTYPE_FADER + 4)
Public Const MIXERCONTROL_CONTROLTYPE_LOUDNESS = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 4)
Public Const MIXERCONTROL_CONTROLTYPE_MICROTIME = (MIXERCONTROL_CT_CLASS_TIME Or MIXERCONTROL_CT_SC_TIME_MICROSECS Or MIXERCONTROL_CT_UNITS_UNSIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_MILLITIME = (MIXERCONTROL_CT_CLASS_TIME Or MIXERCONTROL_CT_SC_TIME_MILLISECS Or MIXERCONTROL_CT_UNITS_UNSIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT = (MIXERCONTROL_CT_CLASS_LIST Or MIXERCONTROL_CT_SC_LIST_MULTIPLE Or MIXERCONTROL_CT_UNITS_BOOLEAN)
Public Const MIXERCONTROL_CONTROLTYPE_MIXER = (MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT + 1)
Public Const MIXERCONTROL_CONTROLTYPE_MONO = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 3)
Public Const MIXERCONTROL_CONTROLTYPE_MUTE = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 2)
Public Const MIXERCONTROL_CONTROLTYPE_SINGLESELECT = (MIXERCONTROL_CT_CLASS_LIST Or MIXERCONTROL_CT_SC_LIST_SINGLE Or MIXERCONTROL_CT_UNITS_BOOLEAN)
Public Const MIXERCONTROL_CONTROLTYPE_MUX = (MIXERCONTROL_CONTROLTYPE_SINGLESELECT + 1)
Public Const MIXERCONTROL_CONTROLTYPE_ONOFF = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 1)
Public Const MIXERCONTROL_CONTROLTYPE_SLIDER = (MIXERCONTROL_CT_CLASS_SLIDER Or MIXERCONTROL_CT_UNITS_SIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_PAN = (MIXERCONTROL_CONTROLTYPE_SLIDER + 1)
Public Const MIXERCONTROL_CONTROLTYPE_SIGNEDMETER = (MIXERCONTROL_CT_CLASS_METER Or MIXERCONTROL_CT_SC_METER_POLLED Or MIXERCONTROL_CT_UNITS_SIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_PEAKMETER = (MIXERCONTROL_CONTROLTYPE_SIGNEDMETER + 1)
Public Const MIXERCONTROL_CONTROLTYPE_PERCENT = (MIXERCONTROL_CT_CLASS_NUMBER Or MIXERCONTROL_CT_UNITS_PERCENT)
Public Const MIXERCONTROL_CONTROLTYPE_QSOUNDPAN = (MIXERCONTROL_CONTROLTYPE_SLIDER + 2)
Public Const MIXERCONTROL_CONTROLTYPE_SIGNED = (MIXERCONTROL_CT_CLASS_NUMBER Or MIXERCONTROL_CT_UNITS_SIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_STEREOENH = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 5)
Public Const MIXERCONTROL_CONTROLTYPE_TREBLE = (MIXERCONTROL_CONTROLTYPE_FADER + 3)
Public Const MIXERCONTROL_CONTROLTYPE_UNSIGNED = (MIXERCONTROL_CT_CLASS_NUMBER Or MIXERCONTROL_CT_UNITS_UNSIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER = (MIXERCONTROL_CT_CLASS_METER Or MIXERCONTROL_CT_SC_METER_POLLED Or MIXERCONTROL_CT_UNITS_UNSIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_VOLUME = (MIXERCONTROL_CONTROLTYPE_FADER + 1)

Public Const MIXERLINE_TARGETTYPE_AUX = 5
Public Const MIXERLINE_TARGETTYPE_MIDIIN = 4
Public Const MIXERLINE_TARGETTYPE_MIDIOUT = 3
Public Const MIXERLINE_TARGETTYPE_UNDEFINED = 0
Public Const MIXERLINE_TARGETTYPE_WAVEIN = 2
Public Const MIXERLINE_TARGETTYPE_WAVEOUT = 1

Public Const MIXERLINE_COMPONENTTYPE_DST_FIRST = &H0&
Public Const MIXERLINE_COMPONENTTYPE_DST_DIGITAL = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 1)
Public Const MIXERLINE_COMPONENTTYPE_DST_HEADPHONES = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 5)
Public Const MIXERLINE_COMPONENTTYPE_DST_LAST = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 8)
Public Const MIXERLINE_COMPONENTTYPE_DST_LINE = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 2)
Public Const MIXERLINE_COMPONENTTYPE_DST_MONITOR = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 3)
Public Const MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 4)
Public Const MIXERLINE_COMPONENTTYPE_DST_TELEPHONE = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 6)
Public Const MIXERLINE_COMPONENTTYPE_DST_UNDEFINED = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 0)
Public Const MIXERLINE_COMPONENTTYPE_DST_VOICEIN = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 8)
Public Const MIXERLINE_COMPONENTTYPE_DST_WAVEIN = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 7)
Public Const MIXERLINE_COMPONENTTYPE_SRC_FIRST = &H1000&
Public Const MIXERLINE_COMPONENTTYPE_SRC_ANALOG = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10)
Public Const MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 9)
Public Const MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 5)
Public Const MIXERLINE_COMPONENTTYPE_SRC_DIGITAL = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 1)
Public Const MIXERLINE_COMPONENTTYPE_SRC_LAST = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10)
Public Const MIXERLINE_COMPONENTTYPE_SRC_LINE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2)
Public Const MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3)
Public Const MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 7)
Public Const MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 4)
Public Const MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 6)
Public Const MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 0)
Public Const MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 8)

Public Const MIXER_GETCONTROLDETAILSF_VALUE = &H0&
Public Const MIXER_GETCONTROLDETAILSF_LISTTEXT = &H1&
Public Const MIXER_GETCONTROLDETAILSF_QUERYMASK = &HF&

Public Const MIXER_SETCONTROLDETAILSF_VALUE = &H0&
Public Const MIXER_SETCONTROLDETAILSF_CUSTOM = &H1&
Public Const MIXER_SETCONTROLDETAILSF_QUERYMASK = &HF&

Public Const MIXER_GETLINECONTROLSF_ALL = &H0&
Public Const MIXER_GETLINECONTROLSF_ONEBYID = &H1&
Public Const MIXER_GETLINECONTROLSF_ONEBYTYPE = &H2&
Public Const MIXER_GETLINECONTROLSF_QUERYMASK = &HF&

Public Const MIXER_GETLINEINFOF_COMPONENTTYPE = &H3&
Public Const MIXER_GETLINEINFOF_DESTINATION = &H0&
Public Const MIXER_GETLINEINFOF_LINEID = &H2&
Public Const MIXER_GETLINEINFOF_QUERYMASK = &HF&
Public Const MIXER_GETLINEINFOF_SOURCE = &H1&
Public Const MIXER_GETLINEINFOF_TARGETTYPE = &H4&

Public Const MIXERR_BASE = 1024
Public Const MIXERR_INVALCONTROL = (MIXERR_BASE + 1)
Public Const MIXERR_INVALLINE = (MIXERR_BASE + 0)
Public Const MIXERR_INVALVALUE = (MIXERR_BASE + 2)
Public Const MIXERR_LASTERROR = (MIXERR_BASE + 2)

Public Const MMSYSERR_BASE = 0
Public Const MMSYSERR_ALLOCATED = (MMSYSERR_BASE + 4)
Public Const MMSYSERR_BADDEVICEID = (MMSYSERR_BASE + 2)
Public Const MMSYSERR_BADERRNUM = (MMSYSERR_BASE + 9)
Public Const MMSYSERR_ERROR = (MMSYSERR_BASE + 1)
Public Const MMSYSERR_HANDLEBUSY = (MMSYSERR_BASE + 12)
Public Const MMSYSERR_INVALFLAG = (MMSYSERR_BASE + 10)
Public Const MMSYSERR_INVALHANDLE = (MMSYSERR_BASE + 5)
Public Const MMSYSERR_INVALIDALIAS = (MMSYSERR_BASE + 13)
Public Const MMSYSERR_INVALPARAM = (MMSYSERR_BASE + 11)
Public Const MMSYSERR_LASTERROR = (MMSYSERR_BASE + 13)
Public Const MMSYSERR_NODRIVER = (MMSYSERR_BASE + 6)
Public Const MMSYSERR_NOERROR = 0
Public Const MMSYSERR_NOMEM = (MMSYSERR_BASE + 7)
Public Const MMSYSERR_NOTENABLED = (MMSYSERR_BASE + 3)
Public Const MMSYSERR_NOTSUPPORTED = (MMSYSERR_BASE + 8)


Public Type Target
        dwType As Long                 '  MIXERLINE_TARGETTYPE_xxxx
        dwDeviceID As Long             '  target device ID of device type
        wMid As Integer                   '  of target device
        wPid As Integer                   '       "
        vDriverVersion As Long            '       "
        szPname As String * MAXPNAMELEN
End Type

Public Type MIXERCONTROLDETAILS_UNSIGNED
        dwValue As Long
End Type
Public Type MIXERCONTROLDETAILS_SIGNED
        lValue As Long
End Type
Public Type MIXERCONTROLDETAILS_BOOLEAN
        fValue As Long
End Type
Public Type MIXERCONTROLDETAILS_LISTTEXT
        dwParam1 As Long
        dwParam2 As Long
        szName As String * MIXER_LONG_NAME_CHARS
End Type

Public Type MIXERCONTROL
        cbStruct As Long           '  size in Byte of MIXERCONTROL
        dwControlID As Long        '  unique control id for mixer device
        dwControlType As Long      '  MIXERCONTROL_CONTROLTYPE_xxx
        fdwControl As Long         '  MIXERCONTROL_CONTROLF_xxx
        cMultipleItems As Long     '  if MIXERCONTROL_CONTROLF_MULTIPLE set
        szShortName As String * MIXER_SHORT_NAME_CHARS
        szName As String * MIXER_LONG_NAME_CHARS
        Bounds As Double
        Metrics As Long
End Type

Public Type MIXERCAPS
        wMid As Integer                   '  manufacturer id
        wPid As Integer                   '  product id
        vDriverVersion As Long            '  version of the driver
        szPname As String * MAXPNAMELEN   '  product name
        fdwSupport As Long             '  misc. support bits
        cDestinations As Long          '  count of destinations
End Type

Public Type MIXERLINECONTROLS
        cbStruct As Long       '  size in Byte of MIXERLINECONTROLS
        dwLineID As Long       '  line id (from MIXERLINE.dwLineID)
                                             '  MIXER_GETLINECONTROLSF_ONEBYID or
        dwControl As Long  '  MIXER_GETLINECONTROLSF_ONEBYTYPE
        cControls As Long      '  count of controls pmxctrl points to
        cbmxctrl As Long       '  size in Byte of _one_ MIXERCONTROL
        pamxctrl As Long       '  pointer to first MIXERCONTROL array
End Type

Public Type MIXERLINE
        cbStruct As Long               '  size of MIXERLINE structure
        dwDestination As Long          '  zero based destination index
        dwSource As Long               '  zero based source index (if source)
        dwLineID As Long               '  unique line id for mixer device
        fdwLine As Long                '  state/information about line
        dwUser As Long                 '  driver specific information
        dwComponentType As Long        '  component type line connects to
        cChannels As Long              '  number of channels line supports
        cConnections As Long           '  number of connections (possible)
        cControls As Long              '  number of controls at this line
        szShortName As String * MIXER_SHORT_NAME_CHARS
        szName As String * MIXER_LONG_NAME_CHARS
        lpTarget As Target
End Type

Type sunion
    hwndOwner As Long
    cMultipleItems As Long
End Type

Public Type MIXERCONTROLDETAILS
        cbStruct As Long       '  size in Byte of MIXERCONTROLDETAILS
        dwControlID As Long    '  control id to get/set details on
        cChannels As Long      '  number of channels in paDetails array
        item As Long           ' hwndOwner or cMultipleItems
        'union As sunion
        cbDetails As Long      '  size of _one_ details_XX struct
        paDetails As Long    '  pointer to array of details_XX structs
End Type

Declare Function mixerOpen Lib "winmm.dll" (phmx As Long, ByVal uMxId As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal fdwOpen As Long) As Long
Declare Function mixerClose Lib "winmm.dll" (ByVal hmx As Long) As Long
Declare Function mixerGetID Lib "winmm.dll" (ByVal hmxobj As Long, puMxId As Long, ByVal fdwId As Long) As Long
Declare Function mixerGetLineControls Lib "winmm.dll" Alias "mixerGetLineControlsA" (ByVal hmxobj As Long, pmxlc As MIXERLINECONTROLS, ByVal fdwControls As Long) As Long
Declare Function mixerGetDevCaps Lib "winmm.dll" Alias "mixerGetDevCapsA" (ByVal uMxId As Long, pmxcaps As MIXERCAPS, ByVal cbmxcaps As Long) As Long
Declare Function mixerGetLineInfo Lib "winmm.dll" Alias "mixerGetLineInfoA" (ByVal hmxobj As Long, pmxl As MIXERLINE, ByVal fdwInfo As Long) As Long
Declare Function mixerGetControlDetails Lib "winmm.dll" Alias "mixerGetControlDetailsA" (ByVal hmxobj As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As Long
Declare Function mixerSetControlDetails Lib "winmm.dll" (ByVal hmxobj As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As Long
Declare Function mixerGetNumDevs Lib "winmm.dll" () As Long


Public Function GetControlValue(compType As Long, ctrl As Long) As Long

    Dim mixerLineCtrl As MIXERLINECONTROLS
    Dim mixerCtrl As MIXERCONTROL
    Dim mixerCapabilities As MIXERCAPS
    Dim lineInfo As MIXERLINE
    Dim targ As Target
    Dim cbmxcaps As Long
    Dim I As Long
    Dim dline As MIXERCONTROLDETAILS_UNSIGNED
    Dim lineDetails As MIXERCONTROLDETAILS
   
    mixerGetNumDevs
    mixerOpen phmx, MIXER_OBJECTF_MIXER, 0, 0, MIXER_OBJECTF_HMIXER
   
    'cbmxcaps = 256
    'mixerGetID phmx, 0, MIXER_OBJECTF_HMIXER
    'mixerGetDevCaps phmx, mixerCapabilities, cbmxcaps
   
    With lineInfo
        .cbStruct = 256
        .dwComponentType = compType
    End With
    mixerGetLineInfo phmx, lineInfo, MIXER_GETLINEINFOF_COMPONENTTYPE

    With mixerLineCtrl
        .cbStruct = 1024
        .cbmxctrl = 1024
        .dwControl = ctrl
        .dwLineID = lineInfo.dwLineID
        .pamxctrl = VarPtr(mixerCtrl)
    End With
    mixerGetLineControls phmx, mixerLineCtrl, MIXER_GETLINECONTROLSF_ONEBYTYPE
   
    With lineDetails
        .cbDetails = 128
        .cbStruct = 128
        .cChannels = 1
        .dwControlID = mixerCtrl.dwControlID
        .paDetails = VarPtr(dline)
        .item = 0
    End With
    mixerGetControlDetails phmx, lineDetails, MIXER_GETCONTROLDETAILSF_VALUE
   
    GetControlValue = (dline.dwValue) \ 100
   
    mixerClose phmx

End Function

Public Function SetControlValue(compType As Long, ctrl As Long, val As Long)

    Dim mixerLineCtrl As MIXERLINECONTROLS
    Dim mixerCtrl As MIXERCONTROL
    Dim mixerCapabilities As MIXERCAPS
    Dim lineInfo As MIXERLINE
    Dim targ As Target
    Dim cbmxcaps As Long
    Dim I As Long
    Dim dline As MIXERCONTROLDETAILS_UNSIGNED
    Dim lineDetails As MIXERCONTROLDETAILS
   
    mixerGetNumDevs
    mixerOpen phmx, MIXER_OBJECTF_MIXER, 0, 0, MIXER_OBJECTF_HMIXER
   
    'cbmxcaps = 256
    'mixerGetID phmx, 0, MIXER_OBJECTF_HMIXER
    'mixerGetDevCaps phmx, mixerCapabilities, cbmxcaps
   
    With lineInfo
        .cbStruct = 256
        .dwComponentType = compType
    End With
    mixerGetLineInfo phmx, lineInfo, MIXER_GETLINEINFOF_COMPONENTTYPE

    With mixerLineCtrl
        .cbStruct = 1024
        .cbmxctrl = 1024
        .dwControl = ctrl
        .dwLineID = lineInfo.dwLineID
        .pamxctrl = VarPtr(mixerCtrl)
    End With
    mixerGetLineControls phmx, mixerLineCtrl, MIXER_GETLINECONTROLSF_ONEBYTYPE
   
    With lineDetails
        .cbDetails = 128
        .cbStruct = 128
        .cChannels = 1
        .dwControlID = mixerCtrl.dwControlID
        .paDetails = VarPtr(dline)
        .item = 0
    End With
    dline.dwValue = 100 * val
    mixerSetControlDetails phmx, lineDetails, MIXER_GETCONTROLDETAILSF_VALUE
   
    mixerClose phmx

End Function

'------------------------

'Bass
SetControlValue MIXERLINE_COMPONENTTYPE_DST_SPEAKERS, MIXERCONTROL_CONTROLTYPE_BASS, bassfader.Value

' Treble
SetControlValue MIXERLINE_COMPONENTTYPE_DST_SPEAKERS, MIXERCONTROL_CONTROLTYPE_TREBLE, treblefader.Value

'CD Volume
SetControlValue MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC, MIXERCONTROL_CONTROLTYPE_VOLUME, volfader.Value

' Master volume
SetControlValue MIXERLINE_COMPONENTTYPE_DST_SPEAKERS, MIXERCONTROL_CONTROLTYPE_VOLUME, volfader.Value


' ----------------------------
' volfader, treblefader, bassfader are splider controls
0
 

Author Comment

by:fred12
Comment Utility
ok
0
 

Author Comment

by:fred12
Comment Utility
test
0
 

Expert Comment

by:fury
Comment Utility
Thank you, Im leaving it open since i cant work now
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now