Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
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 synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

860 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