|
ashwath2005 wrote: Please Help.
I'd like to but without knowing what those functions are returning, it's not possible.
"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
|
|
|
|
|
hi,
I have written the following code for disabling the MUTE control,
MMRESULT result;
HMIXER hMixer;
result = mixerOpen(&hMixer, MIXER_OBJECTF_MIXER, 0, 0, 0);
//obtain a handle to the mixer device.
if(result!=MMSYSERR_NOERROR)
{
::MessageBox(NULL,"Mixer could not be opened","1",MB_OK);
}
//we need to get the speaker line of the mixer device
MIXERLINE ml = {0};
ml.cbStruct = sizeof(MIXERLINE);
ml.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS;
result = mixerGetLineInfo((HMIXEROBJ) hMixer,&ml, MIXER_GETLINEINFOF_COMPONENTTYPE);
if(result!=MMSYSERR_NOERROR)
{
::MessageBox(NULL,"mixerGetLineInfo failed","1",MB_OK);
}
//we need to get the volume control of the speaker line.
MIXERLINECONTROLS mlc = {0};
MIXERCONTROL mc={0};
mc.fdwControl=MIXERCONTROL_CONTROLF_DISABLED;
mlc.cbStruct = sizeof(MIXERLINECONTROLS);
mlc.dwLineID = ml.dwLineID;
mlc.dwControlType = MIXERCONTROL_CONTROLTYPE_MUTE;
mlc.cControls = 1;
mlc.pamxctrl = &mc;
mlc.cbmxctrl = sizeof(MIXERCONTROL);
result = mixerGetLineControls((HMIXEROBJ)hMixer,
&mlc, MIXER_GETLINECONTROLSF_ONEBYTYPE);
if(result!=MMSYSERR_NOERROR)
{
::MessageBox(NULL,"mixerGetLineControls failed","2",MB_OK);
}
//we set the mute and unmute values
MIXERCONTROLDETAILS mcd = {0};
MIXERCONTROLDETAILS_UNSIGNED mcdu = {0};
mcdu.dwValue =lVal; //0 for unmute and //65535 for mute.
mcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
mcd.hwndOwner = 0;
mcd.dwControlID =mc.dwControlID;
mcd.paDetails = &mcdu;
mcd.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED);
mcd.cChannels = 1;
result = mixerSetControlDetails((HMIXEROBJ)hMixer,
&mcd, MIXER_SETCONTROLDETAILSF_VALUE);
if(result!=MMSYSERR_NOERROR)
{
::MessageBox(NULL,"mixerSetControlDetails failed","3",MB_OK);
}
The above code does not disable the MUTE control.
I have checked all the return values,all of them return MMSYSERR_NOERROR as the return value.
Kindly help me to fix this problem.
|
|
|
|
|
ashwath2005 wrote: Kindly help me to fix this problem.
What exactly are you expecting this code to do, disable the Mute all checkbox? If so, 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
|
|
|
|
|
Hi,
I want the code to GRAY the "Mute all" Check box so that user does not have access to it.
|
|
|
|
|
Then you'll need to get a handle to that control (id = 0x3e8) and call EnableWindow(FALSE) .
"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
|
|
|
|
|
hi,
How should i get the handle to the control.Which API should i use.
Please Help
Thanks,
-- modified at 10:23 Tuesday 11th April, 2006
|
|
|
|
|
ashwath2005 wrote: How should i get the handle to the control.Which API should i use.
Try FindWindow() and/or FindWindowEx() .
"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
|
|
|
|
|
hi,
I used the following code to GRAY the "Mute all" check box,but it is not working.Is there any other method.
HWND hwnd1=::FindWindow(NULL,"Volume Control");
HWND hwnd=::GetDlgItem(hwnd1,0x3e8);
::EnableWindow(hwnd,FALSE);
|
|
|
|
|
ashwath2005 wrote: I used the following code to GRAY the "Mute all" check box,but it is not working.
Your code snippet worked fine for me.
ashwath2005 wrote: Is there any other method.
No. What you have will work.
"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
|
|
|
|
|
hi,
I am using Windows XP machine.Which system are you using.May be it does not work on XP system.
|
|
|
|
|
hi,
It worked for me also ,but it works only when the "Volume Control" window is opened and then you execute the code snippet.What should happen is that even when the "Volume Control" window is closed and then you excute the code snippet,it should work.
|
|
|
|
|
ashwath2005 wrote: ...but it works only when the "Volume Control" window is opened
Of course. What else would you expect? The Mute all checkbox does not exist otherwise.
ashwath2005 wrote: What should happen is that even when the "Volume Control" window is closed and then you excute the code snippet,it should work.
Lots of luck to you. It's impossible to manipulate a window/control that does not exist.
"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
|
|
|
|
|
hi,
ok then is there a way to GRAY the volume control icon in the task bar.
|
|
|
|
|
Why would you even consider doing this? Do you not think that the user would be somewhat annoyed that they could not change the volume on their computer? How friendly would that be?
"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
|
|
|
|
|
hi,
There is such a requirement in my project.I should do it.
Could you help please.
|
|
|
|
|
ashwath2005 wrote: There is such a requirement in my project.
Just because it is a requirement does not make it a good idea. Please explain what you are doing and maybe we could could come up with an alternative solution that is more practical.
ashwath2005 wrote: Could you help please.
I just made eight posts to this thread. Don't you think I would have helped if I could? Do you think that I am purposely withholding information?
"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
|
|
|
|
|
hi,
In our project there is an option to Control the Volume of audio of the system,so when the user does control the volume through our software,he should not be allowed to go and change the volume through the system.
|
|
|
|
|
hi,
Can i ask you a question.How did you get the id of the "Mute all" check box to be 0x3e8.
|
|
|
|
|
ashwath2005 wrote: How did you get the id of the "Mute all" check box to be 0x3e8.
Spy++.
"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
|
|
|
|
|
I've got a list of information which I currently display in a CListBox and at present I 'manually' format the data by inserting extra spaces, i.e.
Adam - 260 - 11
Bill - 260 - 2
Caroline - 90 - 6
is there an easy way to get column support into a CListBox or should I be using a different control to display my data?
TIA
|
|
|
|
|
shame codeproject strips out the spaces
|
|
|
|
|
Shame you cannot use the pre and code tags just above the emoticons
|
|
|
|
|
|
Hi,
Why don't you use the CListCtrl instead of the CListBox?
Eli
|
|
|
|
|
cheers, knew there'd be an easy answer (i've never used the CListCtrl before)
|
|
|
|