public static void SetSystemVolume(float fVol) { if (!volInit) { // This may fail if there is no sound card present try { vol = new EndpointVolume(); } catch { vol = null; } } // only try this is sound was initialized if (vol != null) { vol.MasterVolume = fVol; } }