?
Solved

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

Posted on 2007-11-30
3
Medium Priority
?
657 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
[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
  • 2
3 Comments
 
LVL 44

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 44

Expert Comment

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

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this post we will learn different types of Android Layout and some basics of an Android App.
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…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

764 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