Victor
Victor

Reputation: 14573

My dialog doesn't show in MFC C++

I am working on a MFC C++ application, but I met problems while trying to open another dialog in my project.

See in this small video I recorder: click here (Youtube)

Some of my code:

CFindWindow window;
window.DoModal();

This is the FindWindow.h file:

#pragma once


// CFindWindow dialog

class CFindWindow : public CDialogEx
{
    DECLARE_DYNAMIC(CFindWindow)

public:
    CFindWindow(CWnd* pParent = NULL);   // standard constructor
    virtual ~CFindWindow();

// Dialog Data
    enum { IDD = IDD_FINDWINDOW_DIALOG };

protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

    DECLARE_MESSAGE_MAP()
};

I am not sure what do you need in order to help me with this, just tell me, and I will provide you anything you need.

Thanks in advance!

Upvotes: 1

Views: 3304

Answers (4)

JohnCz
JohnCz

Reputation: 1609

It is virtually impossible to give you solution without debugging.

If following advices from previous posts do not help you post your application or test application that duplicates this behavior.

Upvotes: 2

ta.speot.is
ta.speot.is

Reputation: 27214

Sometimes the Resource Compiler doesn't detect changes. Rebuilding the solution can help mitigate this.

Upvotes: 1

Panduranga Rao Sadhu
Panduranga Rao Sadhu

Reputation: 497

Check if there is some other resource already with the same value as IDD_FINDWINDOW_DIALOG. Check in your source code for IDD_FINDWINDOW_DIALOG and see the id number and see if there is some other resource with the same id.

Put a break point and go into DoModal and try.

Alternatively put your code in a try catch block and see if there are any exceptions.

Check if the mainform from which the button click is clicked to invoke findwindow form has overridden any events which might block the findwindow to pop up.

Upvotes: 0

Ulrich Eckhardt
Ulrich Eckhardt

Reputation: 17415

You put that code in a button handler. Put a breakpoint there to make sure it is really called. Alternatively, the TRACE macro is also helpful to log some output for debug builds. With just the info provided (and that video isn't of much help either...) it's hard to tell what is going wrong.

Upvotes: 0

Related Questions