No announcement yet.

Dialog End Cbhndl Vs Close Box

  • Filter
  • Time
  • Show
Clear All
new posts

  • Dialog End Cbhndl Vs Close Box

    I have a app with a tab control and associated tab dialogs. I'm subclassing several controls to the same sub class procedure primarily to have the controls change colors when the mouse is over them.

    If in my code I click a row in a list view on one of the tabbed dialogs it will create a detail screen with buttons that use the subclass. If I exit this detail dialog by clicking the X (close box) and return to the calling tab the subclass functionality remains intact. If I exit the detail screen using a button that simply does a DIALOG END CBHNDL, the hover effect is disabled as if it is no longer subclassed.

    I'm making sure that I kill the sub class in the WM_DESTROY event of the Detail screen for the specific controls that were subclassed when the detail dialog was created.

    So is there any difference between using the close box(X) and DIALOG END CBHNDL that might account for this?

    How can I exactly kill the detail screen like the Close Box (X) does?


  • #2
    In the detail dialog you can intercept WM_SYSCOMMAND/SC_CLOSE (what is sent on "close button" ("X")) and do a DIALOG END (or post a message to yourself to do so, eg, ID_EXIT) at that point.

    Then you'd have to eat the WM_SYSCOMMAND so DDT doesn't get it, which I "think" you do with DDT by returning TRUE.

    This is the same logic you'd use for "Close not allowed at this point" if you might have some of that code lying around.. except you will force the close yourself.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]