|
I guess you need to add the handler in the WinApp class.
and by default MFC will add about dialog unless you explicitly removed the about dialog check box.
|
|
|
|
|
Thank you for reply me, SandipG.
I don't have WinApp class, it's MFC project with Dialog based.
|
|
|
|
|
haha without application class you cant have MFC application.
I am talking about the class which has Initinstance function.
|
|
|
|
|
tataxin wrote: BEGIN_MESSAGE_MAP(CAboutDlg, CMyDlg)
ON_WM_SYSCOMMAND()
END_MESSAGE_MAP()
This is the wrong message map. It should be:
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
ON_WM_SYSCOMMAND()
END_MESSAGE_MAP()
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thank you DavidCrow
It works, but with a little strange. Whenever I right click application in taskbar and select "About ...", nothing happens. Then, I press Alt, the About dialog shows up.
I don't know why????
|
|
|
|
|
tataxin wrote: It works, but with a little strange. Whenever I right click application in taskbar and select "About ...", nothing happens.
Does void CMyDlg::OnSysCommand() get called?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
yes, it does. Here is the source code of OnSysCommand:
void CMyDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
When I try to debug, it stops at (1) until I press Alt. After that, the About dialog shows.
modified on Monday, June 2, 2008 3:51 AM
|
|
|
|
|
I want to detect the names of available MIDI I/O devices and let the user select the devices for MIDI I/O.
How to get the available MIDI device ID & name in VC++?
Thanks & Regards,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
|
Hi,
Thanks for the help!!
Thanks & Regards,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
Hi All,
Is there a similar call as RegLoadKey in kernel mode?
Thank you,
AJ
|
|
|
|
|
What do you want to do excatly?
|
|
|
|
|
I want to shorten my array into by the use of enum, I have not used it yet can anyone give me an idea?
Here is the code:
SchedDay[0] = "Every Sunday";
SchedDay[1] = "Every Monday";
SchedDay[2] = "Every Tuesday";
SchedDay[3] = "Every Wednesday";
SchedDay[4] = "Every Thursday";
SchedDay[5] = "Every Friday";
SchedDay[6] = "Every Saturday";
SchedDay[7] = "Monthly";
for(schedcount = 0; schedcount<8; schedcount++)
{
c_cbCombo1.InsertString(schedcount, _T(SchedDay[schedcount].c_str()));
}
SchedTime[0] = "12:00 AM";
SchedTime[1] = "1:00 AM";
SchedTime[2] = "2:00 AM";
SchedTime[3] = "3:00 AM";
SchedTime[4] = "4:00 AM";
SchedTime[5] = "5:00 AM";
SchedTime[6] = "6:00 AM";
SchedTime[7] = "7:00 AM";
SchedTime[8] = "8:00 AM";
SchedTime[9] = "9:00 AM";
SchedTime[10] = "10:00 AM";
SchedTime[11] = "11:00 AM";
SchedTime[12] = "12:00 PM";
SchedTime[13] = "1:00 PM";
SchedTime[14] = "2:00 PM";
SchedTime[15] = "3:00 PM";
SchedTime[16] = "4:00 PM";
SchedTime[17] = "5:00 PM";
SchedTime[18] = "6:00 PM";
SchedTime[19] = "7:00 PM";
SchedTime[20] = "8:00 PM";
SchedTime[21] = "9:00 PM";
SchedTime[22] = "10:00 PM";
SchedTime[23] = "11:00 PM";
for(timecount = 0; timecount<24; timecount++)
{
c_cbCombo2.InsertString(timecount, _T(SchedTime[timecount].c_str()));
}
And also how will I insert it to the combobox?
Thanks,
Jayjay
|
|
|
|
|
|
use enum instead of array
Thanks
|
|
|
|
|
How would that shorten anything??
|
|
|
|
|
|
C++ doesn't allow an enum of strings.
--
=====
Arman
|
|
|
|
|
You will have enum with same size and
and how your array size will be shortened it still has to store those many entries.
Only thning will change is instead of hardcoding the strings everywhere you will use enum.
|
|
|
|
|
how can i do that to begin with?
Thanks
|
|
|
|
|
You have to declre enum for the strings u want to use.
e.g.
enum {EVERY_MONDAY,EVERY_SUNDAY...}
enum {TWELVE_AM..}
then you can even write a function that will return the strings whenever required.
e.g
CString/char* GetDay(int iVal)
{
switch(iVal)
{
case EVERY_MONDAY:
return "EVERY_MONDAY";
}
...
}
inside code where ever you wan to use you can directly use EVERY_MONDAY...
and offciourse you have to give names to enum you will be creting.
I guess you have never used enums. may be you can read some help for regarding enums.
|
|
|
|
|
All you want to do is, display the time in the combo box.
How about using a loop and CString::Format() function in it to format and display it?
And then you can store all the formatted strings in array.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I am understanding that you want to achieve this with lesser lines of code. If I am right, then:
monsieur_jj wrote: SchedTime[0] = "12:00 AM";
SchedTime[1] = "1:00 AM";
SchedTime[2] = "2:00 AM";
SchedTime[3] = "3:00 AM";
SchedTime[4] = "4:00 AM";
SchedTime[5] = "5:00 AM";
SchedTime[6] = "6:00 AM";
SchedTime[7] = "7:00 AM";
SchedTime[8] = "8:00 AM";
SchedTime[9] = "9:00 AM";
SchedTime[10] = "10:00 AM";
SchedTime[11] = "11:00 AM";
SchedTime[12] = "12:00 PM";
SchedTime[13] = "1:00 PM";
SchedTime[14] = "2:00 PM";
SchedTime[15] = "3:00 PM";
SchedTime[16] = "4:00 PM";
SchedTime[17] = "5:00 PM";
SchedTime[18] = "6:00 PM";
SchedTime[19] = "7:00 PM";
SchedTime[20] = "8:00 PM";
SchedTime[21] = "9:00 PM";
SchedTime[22] = "10:00 PM";
SchedTime[23] = "11:00 PM";
for(timecount = 0; timecount<24; timecount++)
{
c_cbCombo2.InsertString(timecount, _T(SchedTime[timecount].c_str()));
}
You can use this instead of the above quoted code:
CString szTime;
for(int i=0; i<23; ++i)
{
szTime.Format(_T("%d:00 HRS"), i);
c_cbCombo2.InsertString(i, szTime);
}
where c_cbCombo2 is a control variable to the combo box of your interest. I am denoting time in 24 hrs format.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
|
Nibu babu thomas wrote: http://blogs.msdn.com/vcblog/archive/2008/04/30/enums-macros-unicode-and-token-pasting.aspx[^]
This is definitely not the best way of doing things. I don't see any good reason to employ such an ugly solution when using C++. My opinion is that such a technique might look 'cool', but it makes the codebase look horrible, adds unnecessary bloat and makes it difficult to maintain the code in the longer run. Macro substitution is an extremely blind technique; it never cares for semantics or scope in the code. Stroustrup's advise in his book was to avoid macros as much as possible, in fact not to use it at all. And the C++ committee suggests the same too. If there might be a situation where Macros are the only efficient way to do something, I haven't encountered one such situation.
Add: [No, I am not down-voting you, but neither am I going to vote you up in this case]
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
modified on Thursday, May 29, 2008 6:15 AM
|
|
|
|