?
Solved

MFC,C++: CEdit inexplicably has a HWND of X00000000

Posted on 2007-11-30
3
Medium Priority
?
670 Views
Last Modified: 2013-12-14
I've created an MFC CDialog, in the usual way. The following ENSURE is causing the application to trigger a breakpoint:

void CWnd::SetWindowText(LPCTSTR lpszString)
{
      ENSURE(this);
      ENSURE(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));
.....
}

Looking through the call stack, I can see that my CEDit, from which I have called SetWindowTextA(), has a HWND of 0x00000000:

Description = {CEdit hWnd=0x00000000}

This is clearly bogus, but I have no idea why it should be so.

If I don't call any dialog items member functions, the dialog displays without trouble.

I've never had any trouble doing this in the recent past.

MY DoDataExchange is perfect - It was generated by the form editor.

The correct dialog IDD is specified in my enum.

What has gone wrong?

Regards,
Sternocera
0
Comment
Question by:sternocera
  • 2
3 Comments
 
LVL 45

Accepted Solution

by:
AndyAinscow earned 2000 total points
ID: 20380637
You haven't linked the edit control to the edit (in the resource).

Check you have the necessary line in the DoDataExchange.
Check you are NOT calling the SetText before the CDialog::OnInitDialog is called
0
 

Author Comment

by:sternocera
ID: 20380645
Andy,

I forgot to call the base class implementation. Embarresingly enough, this is the second time you've answered the same question in a short period.

I'm quite sick at the moment, so I guess I'm not at my peek.

Anyway, Thanks.
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 20380680
Thanks, and get well soon.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…

862 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