
disable "X" (close button) in ControlBox
you might try this:
****************************
Declare Function GetSystemMenu Lib "user32" Alias "GetSystemMenu" (ByVal
hwnd As Long, ByVal bRevert As Long) As Long
Declare Function GetMenuItemCount Lib "user32" Alias "GetMenuItemCount"
(ByVal hMenu As Long) As Long
Declare Function RemoveMenu Lib "user32" Alias "RemoveMenu" (ByVal hMenu As
Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Declare Function DrawMenuBar Lib "user32" Alias "DrawMenuBar" (ByVal hwnd As
Long) As Long
Public Const MF_BYPOSITION = &H400&
Public Const MF_REMOVE = &H1000&
******************
'Add this subroutine:
Public Sub DisableX(frm As Form)
Dim hMenu As Long
Dim nCount As Long
hMenu = GetSystemMenu(frm.hWnd, 0)
nCount = GetMenuItemCount(hMenu)
'Get rid of the Close menu and its separator
Call RemoveMenu(hMenu, nCount - 1, MF_REMOVE Or MF_BYPOSITION)
Call RemoveMenu(hMenu, nCount - 2, MF_REMOVE Or MF_BYPOSITION)
'Make sure the screen updates the change
DrawMenuBar frm.hWnd
End Sub