Here is a simple code to obtain a master volume value in Windows:

Code:
HMIXER                          hMixer;
MIXERLINE                       ml   = {0};

memset (&ml, 0, sizeof (MIXERLINE));


// get a handle to the mixer device
result = mixerOpen(&hMixer, 0, 0, 0, MIXER_OBJECTF_HMIXER);
    
if (MMSYSERR_NOERROR == result)
{
        ml.cbStruct        = sizeof(MIXERLINE);
        ml.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS;

        // get the speaker line of the mixer device

        result = mixerGetLineInfo((HMIXEROBJ) hMixer, &ml, 
        MIXER_GETLINEINFOF_COMPONENTTYPE);

  .......................
}
the mixer is opened OK. But I get MMSYSERR_INVALPARAM error on the bold line.

This code works perfectly on all machines but one. That computer has a built-in sound card from Realtek.

Does anyone know why it could happen?

Thanks a lot.