|
Well, I think you may test in both cases.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
The C++ Standard guarrantees that new(nothrow) returns NULL if fails.
--
=====
Arman
|
|
|
|
|
Tomerland wrote: I heard/read somewhere that it does not make sense to check for a zero-pointer if operator new is used...
What if new fails?
"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
|
|
|
|
|
|
Which is not thrown on all compilers.
"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
|
|
|
|
|
Really?
But if there is no exception thrown and there is no pointer set to 0. What else should be testet?
|
|
|
|
|
I have a program, written in MFC C++... what change (or add) in this program that work as service.
|
|
|
|
|
|
IMO, you should create a new windows service project and then add your MFC project files to this new one.
Don't know if there would be a direct way of achieving this.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
DO Y have any example... how make a program which run in background...
|
|
|
|
|
Actually wizard will create service for you.
I guess you need to choose ATL COM project and then it gives option to create service. Nor sure about the project type but you can find it easily.
|
|
|
|
|
|
I want to create About dialog after created main dialog. All I did as follows:
- create about dialog
- in Resource.rc, I add this:
STRINGTABLE
BEGIN
IDS_ABOUTBOX "&About ..."
END
- in CMyDlg.h, declare
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
- in CMyDlg.cpp, implement this method:
void CMyDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
- in CMyDlg.cpp, register notify
BEGIN_MESSAGE_MAP(CAboutDlg, CMyDlg)
ON_WM_SYSCOMMAND()
END_MESSAGE_MAP()
that's all, but it doesn't work. I try to debug and found that it doesn't come into OnSysComand() method. What do I miss here?
Thank you very much,
|
|
|
|
|
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?
|
|
|
|