|
I would like to toggle sound in my program via a Menu item.
I have included a Menu option and event as follows, but how can I either set the Menu text 'checked' or change it to read:
Sound On or Sound Off .
void CExampleDlg::OnSystemSound()
{
if(g_bSound)
{
g_bSound = false;
SetDlgItemText(ID_SYSTEM_SOUND, "Sound Off");
}
else
{
g_bSound = true;
SetDlgItemText(ID_SYSTEM_SOUND, "Sound On");
}
}
Where ID_SYSTEM_SOUND is the Menu item. Can you declare a member variable for this Menu item? I saw no options in the Class Wizard.
But the Menu always displays the default text (Sound On); i.e. never changes.
|
|
|
|
|
I believe you need to call CWnd::GetMenu(...) which returns a CMenu* . Check out the member functions in that class.
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
Check this[^] article on menu.
<bold>- Nilesh
<italics>"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
Thanks for your post. Will read the article.
Got code working:-
if(g_bSound)
{
g_bSound = false;
CheckMenuItem(m_MyMenu, ID_SYSTEM_SOUND, MF_UNCHECKED);
}
else
{
g_bSound = true;
CheckMenuItem(m_MyMenu, ID_SYSTEM_SOUND, MF_CHECKED);
}
|
|
|
|
|
i wrote this code about the Matrix project here is a part of the code to input the matrix or a vector with a dynamic allocation:
double*vector ; int num ;
cout<<"enter the size of the vector"<<\n;
cin>>num;
vector=new double[num];
for(i=0;i<num;i++)
{
cout<<"enter="" the="" element"<<i+1<<"in="" vector"<<\n;
="" cin="">>*(vector+i)
}
this for input the vector but for input the matrix i made it in another function:
double*grade ; double**matrix ; int row ; int col;
cout<<"enter the number of rows then coloumns in the matrix"<<\n;
cin>>row>>col;
double**matrix=new double*[row];
for(int j=0;j<row;j++)
{
matrix[j]="new" double[col]
="" for(int="" k="0;" k<row;="" k++)
{
="" for(="" int="" l="0;" l<col;="" l++)
{=""
="" cout<<"enter="" the="" element"<<l+1<<"in="" row"<<k+1<<\n;
="" cin="">>*(grade[k]+l)
}}}
iwant to ask of there is any missing in the followin part of the code
second if i want the program to ask the user if he wants to input one or more matrix can i add this :
for(int c=o;c<n;c++) where="" n="" is="" the="" number="" of="" matrices="" user="" want="" to="" input="" i="" put="" all="" previuos="" for="" loops="" in="" this="" loop="" but="" withmall="" change="" as="" folows
in="" stead="" writing="" matrix[j]i="" will="" write
matrix[c][j]="new" double[col]
&="" instead="" cin="">>*(grade[k]+l) i will write
cin>>*(grade[c][k]+l)
so may you answer these previous questions?
|
|
|
|
|
Use code tag to format the code,
It is difficult to differentiate between your code and comments!
<bold>- Nilesh
<italics>"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
sorry but i dont understand u what do u mean with code tag
do u mean #include<iostream.h>
do u mean something like this
i dont understand what u want sorry
dont u understand my questions?
|
|
|
|
|
When you are showing code in your post, use pre tag which you can find above those smileys. That will make your code to appear in paragraphs instead of them hugging to the left as it was with your post.
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
He means you should format the messages you post for a better readability. By using for instance this format for code extracts or that format to highlight important words. If you don't take care to the format of your message, people will have difficulties to read it or to understand your code, and will simply not answer to the question
|
|
|
|
|
Hi Friends,
I am developing simulator for 8085 microprocessor using C, C++ language. Is there any examples, links, materials or books available to help ?
Waiting for positive reply
Regards,
Amarelia Maehsh
Gujarat
India
|
|
|
|
|
Try this[^]
<bold>- Nilesh
<italics>"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
|
Hi,
I want to create an xml file. I am using MSXML2::IXMLDOMDocument::save() method to do so. Using the sample examples giving on net, but all are giving errors.
I am successfully able to parse an xml document, but save a new xml file always give error. And creates blank xml file.
Can anybody suggest me a sample program to save xml file.
I am using MSXML3/MSXML4 DLLs.
Thanks in advance.
|
|
|
|
|
IXMLDOMDocument expose .xml BSTR variable which contain whole xml file of interface, and by using standered FILE operation you can save it
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Thanks Alok. I will se it. If you have any sample code program, do send it to me.
|
|
|
|
|
Saurabh_Delhi wrote:
If you have any sample code program, do send it to me.
here it is, this actual i am using in one of my application
CStdioFile m_File;
if(m_File.Open(szFilePath,CFile::modeWrite|CFile::modeCreate))
{
char *str=W2T(pDomDoc->xml);
m_File.WriteString(str);
m_File.Close();
}
Saurabh_Delhi wrote:
Thanks Alok
Mention Not buddy
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
I need a drop down color picker on a toolbar .
The concern is when it drops down it should list only 16 specific colors that can be varied dynamically. That is it should list only specific colors in the drop down list.
Are there any specific articles that suit this requirememt.
Thanx in advance.
laiju
|
|
|
|
|
|
|
|
how to decalre a function to timeSetEvent.
thanks.
have a nice day,everybody!
|
|
|
|
|
void CALLBACK TimerFunc(UINT uTimerID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
{
::MessageBox(NULL,"I am here","Hi",MB_OK);
}
MMRESULT mm;
mm = timeSetEvent(5000,1,TimerFunc,0,TIME_PERIODIC | TIME_CALLBACK_FUNCTION);
Will set it to 5 seconds.
this is this.
|
|
|
|
|
Check here[^].
<bold>- Nilesh
<italics>"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
I am using MDI Doc -View architecture.
How can I ensure that only single instance of my application is executed .How can I prevent multiple instances.
laiju
|
|
|
|
|
Have a look Here[^]
You should first try to use the search articles tool at the top of the page before posting. If you had type multiple instance, you would have immediately found the subject article.
|
|
|
|