USUÁRIO:      SENHA:        SALVAR LOGIN ?    Adicione o VBWEB na sua lista de favoritos   Fale conosco 

 

  Dicas

  Visual Basic    (Forms/MDI)

Título da Dica:  Desabilitar as funções e menus Minimize, Maximize, Close e Move do Form
Postada em 31/7/2003 por Juninho         
NUM MODULO COLOQUE ESSE CODIGO

Option Explicit

'DESABILITAR OS BOTOES FECHAR MINIMIZAR MAXIMIZAR
Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long

Public Const MF_BYPOSITION = &H400&


NUM FORM COLOQUE ESSE CODIGO

Option Explicit

Dim hMenu As Long

Private Sub RemoveMenus(Frm As Form, Remove_Restore As Boolean, Remove_Move As Boolean, Remove_Size As Boolean, Remove_Minimize As Boolean, Remove_Maximize As Boolean, Remove_Seperator As Boolean, Remove_Close As Boolean)

hMenu = GetSystemMenu(hwnd, False)

If Remove_Close Then DeleteMenu hMenu, 6, MF_BYPOSITION
If Remove_Seperator Then DeleteMenu hMenu, 5, MF_BYPOSITION
If Remove_Maximize Then DeleteMenu hMenu, 4, MF_BYPOSITION
If Remove_Minimize Then DeleteMenu hMenu, 3, MF_BYPOSITION
If Remove_Size Then DeleteMenu hMenu, 2, MF_BYPOSITION
If Remove_Move Then DeleteMenu hMenu, 1, MF_BYPOSITION
If Remove_Restore Then DeleteMenu hMenu, 0, MF_BYPOSITION
End Sub

Private Sub CmdDestravarTodosBotoes_Click()
hMenu = GetSystemMenu(hwnd, True)
RemoveMenus Me, False, False, False, False, False, False, False
End Sub

Private Sub CmdTravarTodosBotoes_Click()
RemoveMenus Me, True, True, True, True, True, True, True
End Sub

Essa dica funciona tanto para MDIForms ou Forms, desde que vc mude esse trevo aqui:

Para MDIForms -> Private Sub RemoveMenus(Frm As MDIForm Bla...Bla
Para Forms    -> Private Sub RemoveMenus(Frm As Form Bla...Bla
 


CyberWEB Network Ltda.    © Copyright 2000-2024   -   Todos os direitos reservados.
Powered by HostingZone - A melhor hospedagem para seu site
Topo da página