Question

HI I am create a mimic of the Windows Context menu.

Show dialog does the follow:

  1. creates a dialog using CreateDialogIndirectParam
  2. runs a message loop:

    while ( ContinueModal() && GetMessage(&msg, NULL, 0, 0) )
    {
        TranslateMessage( &msg );
        DispatchMessage( &msg );
    }
    
  3. I the dialog I look for lost focus event of the new window there I set the ContinueModel flag to false and call EndDialog / DestroyWindow.

    • Calling EndDialog doesn't kill my dialog, DestroyWindow does. Is this ok, can anyone explain why?

Thanks! D.

Était-ce utile?

La solution

Like it says in the first line of the documentation, EndDialog ends modal dialogs. Your dialog is not modal, so EndDialog is the wrong function. The documentation for CreateDialogIndirectParam says

To destroy the dialog box, use the DestroyWindow function.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top