PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Using the System Menu 'X' to Close a Form  (Read 556 times)

Andy Flowers

  • Guest
Using the System Menu 'X' to Close a Form
« on: February 29, 2008, 12:20:30 AM »

How do I get my code to respond to closing the form using the System menu - "The X in the right top corner" WM_DESTROY seem to not be triggered?
Logged

Rudolf Fürstauer

  • Guest
Re: Using the System Menu 'X' to Close a Form
« Reply #1 on: February 29, 2008, 02:42:10 AM »

Hi Andy,
you can use %SC_CLOSE:

Code: [Select]
'------------------------------------------------------------------------------------------------------------------------
'
'------------------------------------------------------------------------------------------------------------------------
Function FRMBEWERTUNG_CUSTOM (hWndForm As Dword, wMsg As Long, wParam As Dword, lParam As Long) As Long

'--------------------------------------

'--------------------------------------------
' Message?
'--------------------------------------------
Select Case wMsg

'SYSCOMMAND
'--------------------------------------------
        Case %WM_SYSCOMMAND
            Select Case LoWrd(wParam)

                'MINIMIZE
                '-------------------------------------------
            Case %SC_MINIMIZE


                'CLOSE
                '-------------------------------------------
                Case %SC_CLOSE

                  FF_CloseForm hWndForm, 1
  End Select

        Case %WM_TRAYICON

        Case %WM_NOTIFY

Fürstauer Rudolf
Logged