views:

179

answers:

2

I'm trying to get a DialogBox with a check box to appear. I added it to the resource file, created the dialog template, and added the class and event handler for the dialog. As I understand it, now I just need to create an instance of the class and call DoModal().


So, I've gone back and done some investigating and played with the code some and this is what I have now

UsingMSPSK PSKDialog;

    if( PSKDialog.DoModal() == IDOK)
    {


    }
    else {
     AfxMessageBox("Not IDOK");
    }
    CTempoDialog TempoDialog;


    if(TempoDialog.DoModal() == IDOK)
        {

        }



When I run this, I get no dialog from the PSLDialog.DoModal() call, but I get the AfxMessageBox, then The TempoDialog appears. I stepped through the DoModal() call in the debugger and it seemed to run and return properly, so I can't figure out where my Dialog Box is going.

I just looked at the return value of the DoModal() call again, and it seems that it is exiting immediately, how can I fix that?

+2  A: 

It should work to make the dialog visible - assuming the dialog template has the WS_VISIBLE style and so on. Maybe the dialog initialisation is failing? Does the "DoModal" dialog call exit immediately? This would indicate a failure to create the window.

What version of Visual Studio are you using? Version 6 used to not let you set breakpoints on code that was not yet loaded. Alternatively, make sure that the symbols are loaded. In the Modules window, right click the dll containing your code and choose "Load symbols". Are you making a debug build with symbolic information, or a release build? Make sure it is a debug build for the easiest debugging experience.

1800 INFORMATION
A: 

I'm not sure why this happened, but the check box I added was an ActiveX control, and it broke my dialog box. When I discovered the toolbox pane, and dragged a check box from there, it worked fine.

thepocketwade