CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    OnInitDialog problem

    Hi,

    Can you help me solve this problem?

    I have two dialogs. From the first dialog class, I create an instance of the second dialog and call DoModal() (this happens when user clicks a button).

    The problem is that the first function called by MFC in the second dialog's class is DoDataExchange(), not OnInitDialog() ! The following ASSERT() fails :

    HWND CDataExchange::PrepareCtrl(int nIDC)
    {
    ASSERT(nIDC != 0);
    ASSERT(nIDC != -1); // not allowed
    HWND hWndCtrl;
    m_pDlgWnd->GetDlgItem(nIDC, &hWndCtrl);
    if (hWndCtrl == NULL)
    {
    TRACE1("Error: no data exchange control with ID 0x%04X.\n", nIDC);
    ASSERT(FALSE); //THIS ONE FAILS.

    Then some of the OnChange....() message handlers are called, which is bizarre.

    Does anybody know why OnInitDialog() isn't being called straight away ?


    Thanks,
    Gaz.


  2. #2
    Join Date
    Apr 1999
    Location
    Vancouver, Canada
    Posts
    10

    Re: OnInitDialog problem

    You can find out which control its complaining about by running in the debugger, just before it asserts, it outputs a line telling you the Control ID it's having problems with. Then you can look in your resources.h file to see what control its confused about. It's basically telling you that there is an ID number with no associated control.

    You probably have some mismatch between your resources.rc and resources.h file.

    Dan


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured