문제

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