Solved

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

Posted on 2007-11-30
3
639 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 44

Accepted Solution

by:
AndyAinscow earned 500 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Eclipse Neon start with Admin account only 6 125
Need an intro to -- .Net SQL Authorization Manager 7 87
egit plugin on eclipse 8 63
C# LINQ ForEach() question 6 27
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

770 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