Private Const CS_NOCLOSE = &H200 Private Const GCL_STYLE = (-26) Private Declare Function GetClassLong Lib "user32" Alias "GetClassLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Sub Command1_Click() Dim style As Long style = GetClassLong(hwnd, GCL_STYLE) SetClassLong hwnd, GCL_STYLE, style Or CS_NOCLOSE Refresh End Sub Private Sub Command2_Click() Dim style As Long style = GetClassLong(hwnd, GCL_STYLE) SetClassLong hwnd, GCL_STYLE, style And (Not CS_NOCLOSE) Refresh End SubCAUTION: This code modifies the class, from which VB creates its form. I.e. ALL FORMS INTO THE PROJECT WILL HAVE DISABLED CLOSE BUTTON UNTIL YOU RESTART VB OR RE-ENABLE CLOSE BUTTON!!!
Plamen Ivanov
MCSD .NET Early Achiever and MCAD .NET Charter Member (VB .NET/SQL Server 2000)
MCSD (VB 6.0/SQL Server 2000) br>
VB (.NET) - what other language do you need in the whole Universe?...