Solved

Window Handle

Posted on 1997-02-20
3
222 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
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Making a Sample Win32 DLL project Using Visual Studio 2010 Professional 4 96
how to understand recursion 12 226
FMX enumerated colours 2 100
Add values of each row in an array 3 57
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

777 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