Announcement

Collapse
No announcement yet.

Abort Dialog before it shows on WM_INITDIALOG?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Edwin Knoppert
    replied
    I forgot '2A'..

    2) Create dialog
    Do what you did in WM_INITDIALOG by using the hWnd of the dialog created.
    But right after the dialog creation call.

    Leave a comment:


  • Michael Mattias
    replied
    That's what I did.

    I must have suffered a brief "shiftless, lazy" attack, but I'm all better now.

    Leave a comment:


  • Edwin Knoppert
    replied
    That's probably since you make the same mistake as i seen others do?

    Iow, executing code in WM_INITDIALOG... (which is then an 'event' you try to stop)

    Move this code to a more sequential location like:

    1) Test if dialog is needed
    2) Create dialog
    3) Show dialog
    4) Messagepump

    Leave a comment:


  • Michael Mattias
    replied
    EndDialog....

    "Duh!" on me!

    Leave a comment:


  • Michael Mattias
    replied
    I changed the logic. I may as well 'do it right', no?

    Still interested in an answer .. if there is a way to suppresss visibility of dialog once we get as far as Creating it (CreateDialog or DialogBox).

    Leave a comment:


  • Kev Peel
    replied
    From win32.hlp:

    A dialog box procedure can call EndDialog at any time, even during the processing of the WM_INITDIALOG message. If your application calls the function while WM_INITDIALOG is being processed, the dialog box is destroyed before it is shown and before the input focus is set.

    Leave a comment:


  • Abort Dialog before it shows on WM_INITDIALOG?

    I have a dialog I am creating SDK-style (createDialog). On WM_INITDIALOG I can detect a condition in which I no longer want to show the dialog at all.

    While I can end the dialog by posting WM_CLOSE, I get a "flicker" of it which is annoying.

    I have tried changing the style (add stule (NOT %WS_VISIBLE)) and Hiding it (ShowWindow hWnd, %SW_HIDE), both on WM_INITDIALOG , but I still get a flicker.

    With "non-dialog" windows you can abort window creation by returning TRUE to WM_CREATE; but it does not appear you can abort on WM_INITDIALOG when using a dialog (vs registered window class).

    Before I go change all my logic to do the test first or maybe change to a registered window class, am I missing some way to abort the presentation of the dialog BEFORE it ever shows?

    I don't get WM_NCCREATE, either, so I can't do it there.

    Thanks,
    Last edited by Michael Mattias; 7 Feb 2008, 06:12 PM.
Working...
X