Announcement

Collapse
No announcement yet.

Controlling behavior of Close Box on caption bar

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

  • Controlling behavior of Close Box on caption bar

    I'm using a dialog for multiple purposes. To distinguish them for the user I place an appropriate icon on the caption bar. To do this I must include %WS_SYSMENU in the template and this activates the CLOSE button. I want to disable this button and the CLOSE option in the system menu. All user response is then placed in one CANCEL button in the dialog. How do I get the ID of the close box so that I can disable it?

    Thanx,

    John Neubauer

    I may have found the answer in a FAQ.
    Last edited by John Neubauer; 30 Jan 2008, 08:24 PM. Reason: I think I found the answer in a FAQ

  • #2
    Instead of disabling the button, how about trapping WM_SYSCOMMAND/SC_CLOSE in the callback and then triggering the cancel button code, using either GOTO or by sending BM_CLICK:

    Code:
             Case %WM_SYSCOMMAND
                 If (wParam And &HFFF0) = %SC_CLOSE Then
     
                     ' MUST return TRUE to stop the dialog being destroyed...
                     Function = %TRUE
     
                     ' Call the shutdown code using GOTO...
                     GOTO MyShutDown:
     
                     ' OR, shutdown using the cancel button...
                     CONTROL SEND CBHNDL, %IDCANCEL, %BM_CLICK, 0, 0
     
                     Exit Function
                  End If
    kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

    Comment


    • #3
      This will DISABLE the close "X"

      DeleteMenu GetSystemMenu(hWnd,BYVAL 0),%SC_CLOSE,%MF_BYCOMMAND

      Comment


      • #4
        DeleteMenu deletes, not disables.

        EnableMenuItem enables or disables.

        Whic to use depends on your preference: do you want the user to see the familiar System menu, but with "Close" greyed out and not selectable? Or would you prefer to have him see a menu which does not include a greyed-out "Close?"
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment

        Working...
        X