Wrox Programmer Forums
|
BOOK: Ivor Horton's Beginning Visual C++ 2005
This is the forum to discuss the Wrox book Ivor Horton's Beginning Visual C++ 2005 by Ivor Horton; ISBN: 9780764571978
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Ivor Horton's Beginning Visual C++ 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 10th, 2006, 11:14 PM
Registered User
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default AfxMessageBox problem

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:

Code:
    InitCtrls.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(&InitCtrls);

    CWinApp::InitInstance();

    // Initialize OLE libraries
    if (!AfxOleInit())
    {
        AfxMessageBox(IDP_OLE_INIT_FAILED);
        return FALSE;
    }
    AfxEnableControlContainer();


Any ideas?

 
Old September 13th, 2006, 01:35 AM
Authorized User
 
Join Date: May 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old September 13th, 2006, 02:51 AM
Registered User
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried those options also, I got around the problem by quoting out the line which was causing the problem to occur.

 
Old September 13th, 2006, 11:40 PM
Authorized User
 
Join Date: May 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
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.

 
Old September 14th, 2006, 12:02 AM
Registered User
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The whole problem is to do with the AfxMessage system...


I simply quoted out the following line and it worked fine...
Code:
//    AfxMessageBox(IDP_OLE_INIT_FAILED);









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.