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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top