|
Subject:
|
AfxMessageBox problem
|
|
Posted By:
|
Paid The Umpire
|
Post Date:
|
9/10/2006 11:14:11 PM
|
Hi,
I'm just going through this book slowly, trying to learn C++ and I have got to Chapter 12 (Windows programming with MFC) and I can't compile any of the programs.
It gives me the error: 1>c:\cprograms\sketcher\sketcher\sketcher.cpp(62) : error C3861: 'AfxMessageBox': identifier not found
I can't see what the problem is... he is the code the error is refering to:
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
// Initialize OLE libraries
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
Any ideas?
|
|
Reply By:
|
Nick Y
|
Reply Date:
|
9/13/2006 1:35:48 AM
|
Hi,
Chapter 12 went OK for me.
a) Have you tried running the pre-written code, downloaded from here? I found that that helped in that I could narrow down a problem to my typing/ typo in the book/ my misunderstanding...
b) I had typing/syntax problems hence found a file comparison utility (free.) I used it to compare my code with that in 'a' above. Obviously slight differences with comments, etc. but these were easily bypassed and - eventually - errors found.
c) Failing above -or if 'a' fails, have you installed everything with Visual Studio?
Just some off the cuff ideas; I hope that they help you.
|
|
Reply By:
|
Paid The Umpire
|
Reply Date:
|
9/13/2006 2:51:45 AM
|
I tried those options also, I got around the problem by quoting out the line which was causing the problem to occur.
|
|
Reply By:
|
Nick Y
|
Reply Date:
|
9/13/2006 11:40:00 PM
|
quote: Originally posted by Paid The Umpire
I tried those options also, I got around the problem by quoting out the line which was causing the problem to occur.
Might be worth copying the quoted line to here, in case others meet the same problem as you.
|
|
Reply By:
|
Paid The Umpire
|
Reply Date:
|
9/14/2006 12:02:46 AM
|
The whole problem is to do with the AfxMessage system...
I simply quoted out the following line and it worked fine...
// AfxMessageBox(IDP_OLE_INIT_FAILED);
|