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

 

  Dicas

  Visual Basic    (Windows)

Título da Dica:  Desabilitar o menu iniciar do Windows
Postada em 6/1/2003 por virtam            
'-----------------------------------Em um modulo
Public Declare Function FindWindow& Lib "user32" Alias "FindWindowA" (ByVal lpClassName$, ByVal lpWindowName$)
Public Declare Function EnumChildWindows Lib "user32" _
   (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, _
   ByVal lParam As Long) As Long
  
Declare Function GetClassName Lib "user32" Alias "GetClassNameA" _
   (ByVal hWnd As Long, ByVal lpClassName As String, _
   ByVal nMaxCount As Long) As Long

Public Declare Function EnableWindow Lib "user32" _
   (ByVal hWnd As Long, ByVal fEnable As Long) As Long

Public StartButtonhWnd As Long

  
Public Function EnumChildProc(ByVal lhWnd As Long, ByVal lParam As Long) _
   As Long
   Dim RetVal As Long
   Dim WinClassBuf As String * 255
   Dim WinClass As String
  
   RetVal = GetClassName(lhWnd, WinClassBuf, 255)
   WinClass = StripNulls(WinClassBuf)  ' remove extra Nulls & spaces
   If WinClass = "Button" Then
      StartButtonhWnd = lhWnd
      RetVal = EnableWindow(StartButtonhWnd, False)
      EnumChildProc = False  ' Stop looking
   Else
      EnumChildProc = True   ' Keep looking
   End If
End Function

Public Function StripNulls(OriginalStr As String) As String  
   If (InStr(OriginalStr, Chr(0)) > 0) Then
      OriginalStr = Left(OriginalStr, InStr(OriginalStr, Chr(0)) - 1)
   End If
   StripNulls = OriginalStr
End Function

'-----------------------------------No Botão Desabilitar
Dim WinClass As String
Dim TaskBarHwnd As Long, lRet As Long, lParam As Long
'
WinClass = "Shell_TrayWnd"
'
TaskBarHwnd = FindWindow(WinClass, vbNullString)
'
lRet = EnumChildWindows(TaskBarHwnd, AddressOf EnumChildProc, lParam)

'-----------------------------------No Botão Habilitar
  Dim RetVal As Long
    If StartButtonhWnd <> 0 Then
        RetVal = EnableWindow(StartButtonhWnd, True)
    End If
 


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