//************************************** // Name: _ Disable the X button on your form, or another Windows form at run-time (with HWND)_ // Description:This code will disable the X button on any form you know the HWND (unique number) for. To test this code on your own application, provide the function with ActiveForm.Handle().ToInt32() // By: Jon Barker (from psc cd) // // // Inputs:None // // Returns:None // //Assumes:None // //Side Effects:None //************************************** Public Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Integer, ByVal bRevert As Integer) As Integer Public Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Integer, ByVal nPosition As Integer, ByVal wFlags As Integer) As Integer Public Const SC_CLOSE = &HF060& Public Const MF_BYCOMMAND = &H0& Function RemoveXButton(ByVal iHWND As Integer) As Integer Dim iSysMenu As Integer iSysMenu = GetSystemMenu(iHWND, False) Return RemoveMenu(iSysMenu, SC_CLOSE, MF_BYCOMMAND) End Function 'Disable the button on the current form: // RemoveXButton(ActiveForm.Handle().ToInt3 // 2()) // 'Thats it! tHe_cLeanER ownz you...