Solved

Window Handle

Posted on 1997-02-20
3
230 Views
Last Modified: 2010-04-10
I have a class Parent which inherit from CFrameWnd-class.
In this class I call the CFrameWnd::Create function to obtain for my class a valid handle.
Now I want to inherit another class, Parent1, from the Parent-class.
If I call in the Parent1-class the Create function, I have an error during the execution phase, but if I don't call this function, the Message map in the Parent1-class generates the error: Access Violation during the execution phase.
How can I resolve this problem?
Is it possible to have for the Parent1-class a valid handle different from the Parent-calss's handle?
It's important for me to have a valid handle because I have to handle my personal messages.
Thanks for the answers.
Bye.
0
Comment
Question by:casola
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 23

Expert Comment

by:chensu
ID: 1162111
Would you show me some parts of your source code?
0
 

Author Comment

by:casola
ID: 1162112
Could you give me some answer?
I'll try to write down part of my source code.
0
 

Accepted Solution

by:
shurik earned 20 total points
ID: 1162113
I suppose you've got a mistake in message map declaration for your Parent1 class. This is the working example. I've made single document application using Application Wizard, then

class CInheritFrame : public CMainFrame
{
protected: // create from serialization only
      DECLARE_DYNCREATE(CInheritFrame)

// Attributes
public:
      CInheritFrame() {;}
      BOOL Create() { return CFrameWnd::Create(NULL, "CInheritFrame"); }

// Operations
public:

// Overrides
      // ClassWizard generated virtual function overrides
      //{{AFX_VIRTUAL(CInheritFrame)
      //}}AFX_VIRTUAL

// Implementation
public:
      virtual ~CInheritFrame() {;}

protected:  // control bar embedded members
      CStatusBar  m_wndStatusBar;
      CToolBar    m_wndToolBar;

// Generated message map functions
protected:
      //{{AFX_MSG(CInheritFrame)
      //}}AFX_MSG
      DECLARE_MESSAGE_MAP()
};

then somewhere, for example CDoc::OnNewDocument

      CInheritFrame * pFrame = new CInheritFrame;
      BOOL b = pFrame->Create();
      pFrame->ShowWindow(SW_SHOW);

You will see second frame window


0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
c++ how to tell if the progra is ctl or mfc atl ect 6 99
SetCurrentDirectory path limit 7 144
Cross compile release version of c++ program for linux 2 139
Dialogbox API leak? 18 109
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question