Hola a todos, necesito saber como se hace para q en un formulario aparezca el botón cerrar deshabilitado hasta q termine de correr un proceso y recien habilitarlo para poder cerrar el formulario. Gracias de antemano. Saludo Atte. Javier
Solo haz dos botones "Command1 y Command2" Option Explicit Private Declare Function GetSystemMenu Lib "user32" _ (ByVal hWnd As Long, ByVal bRevert As Long) As Long Private Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" _ (ByVal hMenu As Long, ByVal nPosition As Long, _ ByVal wFlags As Long, ByVal wIDNewItem As Long, _ ByVal lpString As Any) As Long Private Declare Function DrawMenuBar Lib "user32" _ (ByVal hWnd As Long) As Long ' Private Const MF_BYCOMMAND = &H0& Private Const MF_ENABLED = &H0& Private Const MF_GRAYED = &H1& ' Private Const SC_CLOSE = &HF060& Private Sub Command1_Click() ' Deshabilitar el botón de cerrar el formulario Dim hMenu As Long ' hMenu = GetSystemMenu(hWnd, 0) Call ModifyMenu(hMenu, SC_CLOSE, MF_BYCOMMAND Or MF_GRAYED, -10, "Close") ' Call DrawMenuBar(hWnd) ' End Sub Private Sub Command2_Click() ' Habilitar el botón de cerrar el formulario Dim hMenu As Long ' hMenu = GetSystemMenu(hWnd, 0) Call ModifyMenu(hMenu, -10, MF_BYCOMMAND Or MF_ENABLED, SC_CLOSE, "Close") Call DrawMenuBar(hWnd) ' End Sub