|
Hi, does anyone know how to change/mute the windows volume in xp?!
thanks,
Mark
|
|
|
|
|
did u try searching[^] for it
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
|
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
don't mind, he drank too much today...
|
|
|
|
|
yea. I found a couple of samples, but I didnt recognise the code. Im quite new to c++. I think it was MFC, which I dont have any experience with. I have searched everywhere on the net, but just cant find it anywhere.
Do you have any ideas?
Thanks,
Mark
|
|
|
|
|
This is the CMute.h file
class CMute
{
public:
UINT m_nNumMixers;
HMIXER m_hMixer;
MIXERCAPS m_mxcaps;
DWORD m_dwMuteControlID;
BOOL amdUninitialize();
BOOL amdInitialize();
BOOL amdGetMasterMuteControl();
BOOL amdGetMasterMuteValue(LONG &lVal) const;
BOOL amdSetMasterMuteValue(LONG lVal) const;
};
this is the CMute.cpp file
BOOL CMute::amdInitialize()
{
ASSERT(m_hMixer == NULL);
m_nNumMixers = ::mixerGetNumDevs();
m_hMixer = NULL;
::ZeroMemory(&m_mxcaps, sizeof(MIXERCAPS));
m_dwMuteControlID = 0;
if (m_nNumMixers != 0)
{
if (::mixerOpen(&m_hMixer,
0,
reinterpret_cast<DWORD>(this->GetSafeHwnd()),
NULL,
MIXER_OBJECTF_MIXER | CALLBACK_WINDOW)
!= MMSYSERR_NOERROR)
{
return FALSE;
}
if (::mixerGetDevCaps(reinterpret_cast<UINT>(m_hMixer),
&m_mxcaps, sizeof(MIXERCAPS))
!= MMSYSERR_NOERROR)
{
return FALSE;
}
}
return TRUE;
}
BOOL CMute::amdUninitialize()
{
BOOL bSucc = TRUE;
if (m_hMixer != NULL)
{
bSucc = (::mixerClose(m_hMixer) == MMSYSERR_NOERROR);
m_hMixer = NULL;
}
return bSucc;
}
BOOL CMute::amdGetMasterMuteControl()
{
if (m_hMixer == NULL)
{
return FALSE;
}
MIXERLINE mxl;
mxl.cbStruct = sizeof(MIXERLINE);
mxl.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS;
if (::mixerGetLineInfo(reinterpret_cast<HMIXEROBJ>(m_hMixer),
&mxl,
MIXER_OBJECTF_HMIXER |
MIXER_GETLINEINFOF_COMPONENTTYPE)
!= MMSYSERR_NOERROR)
{
return FALSE;
}
MIXERCONTROL mxc;
MIXERLINECONTROLS mxlc;
mxlc.cbStruct = sizeof(MIXERLINECONTROLS);
mxlc.dwLineID = mxl.dwLineID;
mxlc.dwControlType = MIXERCONTROL_CONTROLTYPE_MUTE;
mxlc.cControls = 1;
mxlc.cbmxctrl = sizeof(MIXERCONTROL);
mxlc.pamxctrl = &mxc;
if (::mixerGetLineControls(reinterpret_cast<HMIXEROBJ>(m_hMixer),
&mxlc,
MIXER_OBJECTF_HMIXER |
MIXER_GETLINECONTROLSF_ONEBYTYPE)
!= MMSYSERR_NOERROR)
{
return FALSE;
}
m_dwMuteControlID = mxc.dwControlID;
return TRUE;
}
BOOL CMute::amdGetMasterMuteValue(LONG &lVal) const
{
if (m_hMixer == NULL)
{
return FALSE;
}
MIXERCONTROLDETAILS_BOOLEAN mxcdMute;
MIXERCONTROLDETAILS mxcd;
mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
mxcd.dwControlID = m_dwMuteControlID;
mxcd.cChannels = 1;
mxcd.cMultipleItems = 0;
mxcd.cbDetails = sizeof(MIXERCONTROLDETAILS_BOOLEAN);
mxcd.paDetails = &mxcdMute;
if (::mixerGetControlDetails(reinterpret_cast<HMIXEROBJ>(m_hMixer),
&mxcd,
MIXER_OBJECTF_HMIXER |
MIXER_GETCONTROLDETAILSF_VALUE)
!= MMSYSERR_NOERROR)
{
return FALSE;
}
lVal = mxcdMute.fValue;
return TRUE;
}
BOOL CMute::amdSetMasterMuteValue(LONG lVal) const
{
if (m_hMixer == NULL)
{
return FALSE;
}
MIXERCONTROLDETAILS_BOOLEAN mxcdMute = { lVal };
MIXERCONTROLDETAILS mxcd;
mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
mxcd.dwControlID = m_dwMuteControlID;
mxcd.cChannels = 1;
mxcd.cMultipleItems = 0;
mxcd.cbDetails = sizeof(MIXERCONTROLDETAILS_BOOLEAN);
mxcd.paDetails = &mxcdMute;
if (::mixerSetControlDetails(reinterpret_cast<HMIXEROBJ>(m_hMixer),
&mxcd,
MIXER_OBJECTF_HMIXER |
MIXER_SETCONTROLDETAILSF_VALUE)
!= MMSYSERR_NOERROR)
{
return FALSE;
}
return TRUE;
}
i just copied from a tutorial and pasted (with a few changes should work)
add these two files to the project
hope it helps
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
is that MFC?
What are all the '::'?! I think I may be using something else... i take it i wont be able to combine the two in one program?
Thanks for the help!
Mark
|
|
|
|
|
markhaslehurst wrote: What are all the '::'?!
its not MFC its simple C++. :: is scope resolution operator.
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
oh right. ok. because ive only started to learn c++ in the last couple of weeks, and i didnt really know the difference between MFC and normal c++... since I never saw those symbols in what i was doing, i figured they were an MFC thing...
That all makes a lot more sense now, lol! Thanks!
So why would one want to hide a class type?
Thanks,
mark
|
|
|
|
|
markhaslehurst wrote:
Hi, does anyone know how to change/mute the windows volume in xp?!
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Ah! That looks more understandable... so is MFC basically the same, just with different top-level structure?
Thanks!
Do you know how to mute it (other than setting the volume to 0) - as in, similar to checking the 'mute all' option in windows?
Thanks a lot!
Mark
|
|
|
|
|
markhaslehurst wrote: ...is MFC basically the same...
As what?
markhaslehurst wrote: Do you know how to mute it (other than setting the volume to 0) - as in, similar to checking the 'mute all' option in windows?
No, I've never looked.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
as visual c++... or im guessing there is another type of c++, apart from mfc... are they v different?
ok. well thanks a lot for that link. its proving really useful... just trying to figure out how to increment the volume at the moment!
Thanks a lot for your help!
Mark
|
|
|
|
|
Visual C++ is Microsoft's implementation of C++.
MFC is a collection of classes, most of which act as a wrapper around the Win32 API. There are classes for many of the handle-managed Windows objects and also for predefined windows and common controls. MFC provides an OO programming model to the Win32 API. See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
oh right. lol. yea. i just kinda decided to jump right into what i wanted to do and skipped over all the basics, so i didnt know any of that!!
thanks for explaining! it all seems so much more logical now!?!
Thanks for being so patient with me!
Mark
|
|
|
|
|
Woo! OK. Ive sorted it out. I can now increment, decrement and mute windows volume! Thanks a lot to everyone for all your help!!
Really appreciated!
Mark
|
|
|
|
|
|
What does PreTranslateMessage() and WM_QUERYENDSESSION have to do with muting the volume?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
ooops, David didn't you notice the topic changing to "OT" and more specifically "MyT" meant to say My Topic. i've been trying to capture the logoff event in a MFC DIALOG based application, but its not getting trapped in the PreTranslateMessage(). the same works fine in a Win32 windows application. i could trap the WM_QUERYENDSESSION. but i've developed my project using MFC framework. can you help me out here??
VuNic
|
|
|
|
|
VuNic wrote: ...didn't you notice the topic changing to "OT"...
Of course I noticed that. I'm not blind. Why would you do it, though? It makes no sense whatsoever. Why jump right into the middle of a thread about A and start asking questions about B?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Of course I noticed that. I'm not blind.
Oooooooooops,I Didn't mean it really , i'm extreeeeemly sorry david. i couldn't guess it would make you this angry.i'll delete it now , sure. ohh.. but please dont stop answering me i hope you'd let me go now. can i?
VuNic
|
|
|
|
|
shuuuuuuuuuut, the forum is sleeping !!
don't make noise
|
|
|
|
|
VuNic
|
|
|
|
|
Hi,
Can anybody guide me how to read XML file using DOM which contains UNICODE characters? I know DOM very well. I have made my own DOM parser as sutaible to my company needs. However nor my implementation or nor the CODE PROJECT's "http://www.codeproject.com/cpp/C___XML_wrapper.asp" applications are able to read the unicode XML file, they are working perfectly with the simple encoding schemes.
Thank you.
|
|
|
|