hi all,
can the close button on the title bar of the form be disabled so that the user can't close the form.
thanx
can the close button on the title bar of the form be disabled so that the user can't close the form.
thanx
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, _
ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, _
ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Sub Form_Load()
RemoveCloseMenuItem (Me.hwnd) ' this is a user define pocedure
end sub
'the actual procedure
Public Sub RemoveCloseMenuItem(ByVal hwnd As Long)
Const SC_CLOSE = &HF060
'Const SC_MINIMIZE = &HF060
Const MF_BYCOMMAND = 0
'Const MF_BYCOMMAND1 = 1
Dim hMenu As Long
'Dim hMenu1 As Long
' get the system menu's handle
hMenu = GetSystemMenu(hwnd, 0)
'hMenu1 = GetSystemMenu(hwnd, 1)
' remove the Close item
RemoveMenu hMenu, SC_CLOSE, MF_BYCOMMAND
'RemoveMenu hMenu1, SC_MINIMIZE, MF_BYCOMMAND1
End Sub
Comment