Wrox Programmer Forums
|
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ 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 June 29th, 2004, 08:32 PM
Registered User
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default pesky code

Can anyone see why this doesnt execute???
Its straight out of the VC++ 6 standard edition book and it just crashes. OS=XPSP1 VC6 +SP6 any ideas would be nice.

Code:
#include <afxwin.h>        

//Class definition

class COurWnd : public CFrameWnd
{
};

//application class definition
class COurApp : public CWinApp
{
public:
    virtual BOOL InitInstance();


private:
    COurWnd* GetMainWindow() { return static_cast<COurWnd*>(m_pMainWnd); }
};

//Function to create instance of main window
BOOL COurApp::InitInstance(void)
{
    //construct an object of our class
    m_pMainWnd = new COurWnd;

    //call create() to do the window
    GetMainWindow()->Create(NULL, _T("Backplane"));

    //Display it
    GetMainWindow()->ShowWindow(m_nCmdShow);
    return TRUE;
}

// Application object in global scope
COurWnd AnApplication;
 
Old July 2nd, 2004, 03:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

Replace the last line of the code with


COurApp AnApplication;

Ankur Verma
.Net and C++ Specialist
Wiley Tech Support





Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent:hard disk serial code and vb code ivanlaw Pro VB 6 0 July 25th, 2007 04:05 AM
Removing pesky dialog boxes. FalseParadigm Access VBA 22 July 20th, 2007 08:47 AM
VB: .Exe file, serial code and activation code ivanlaw Pro VB 6 8 July 6th, 2007 05:44 AM
code clinic - Why wont example asp code work? jardbf Classic ASP Basics 3 April 27th, 2006 06:22 PM
Writing Client Side Script from Code-Behind code sajid_pk Classic ASP Databases 1 January 18th, 2005 12:53 AM





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