Bom dia!!
Não olhei seu anexo, mas tente uma adaptação.
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" ( _
ByVal hWnd As Long, _
ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32" ( _
ByVal hMenu As Long, _
ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
Private Declare Function ShowWindow Lib "user32" ( _
ByVal hWnd As Long, _
ByVal nCmdShow As Long) As Long
Private Declare Function EnableWindow Lib "user32" ( _
ByVal hWnd As Long, _
ByVal fEnable As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" ( _
ByVal hWnd As Long) As Long
Private Declare Function SetFocus Lib "user32" ( _
ByVal hWnd As Long) As Long
Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" ( _
ByVal hInst As Long, _
ByVal lpszExeFileName As String, _
ByVal nIconIndex As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Integer, _
ByVal lParam As Long) As Long
Private Declare Function LockWindowUpdate Lib "user32" ( _
ByVal hWndLock As Long) As Long
'Window styles
Private Const GWL_STYLE As Long = (-16)
Private Const GWL_EXSTYLE As Long = (-20)
Private Const WS_CAPTION As Long = &HC00000
Private Const WS_EX_APPWINDOW As Long = &H40000
Private Const WS_EX_TOOLWINDOW As Long = &H80
Private hWnd As Long
Private Sub UserForm_Activate()
Dim lStyle As Long, hMenu As Long
hWnd = FindWindow("ThunderDFrame", Me.Caption)
If hWnd = 0 Then Exit Sub
lStyle = GetWindowLong(hWnd, GWL_STYLE)
lStyle = lStyle And Not WS_CAPTION
SetWindowLong hWnd, GWL_STYLE, lStyle
lStyle = GetWindowLong(hWnd, GWL_EXSTYLE)
lStyle = lStyle And Not WS_EX_APPWINDOW
lStyle = lStyle And Not WS_EX_TOOLWINDOW
SetWindowLong hWnd, GWL_EXSTYLE, lStyle
DrawMenuBar hWnd
SetFocus hWnd
End Sub
Ou....
'Written: MArch 03,1020
'Author: Leith Ross
'Summary: Locks a UserForm so it can not be resized or moved.
Public Declare Function GetForegroundWindow Lib "user32.dll" () As Long
Private Declare Function GetSystemMenu _
Lib "user32.dll" _
(ByVal hwnd As Long, _
ByVal bRevert As Long) As Long
Private Declare Function DrawMenuBar _
Lib "user32.dll" _
(ByVal hwnd As Long) As Long
Private Declare Function DeleteMenu _
Lib "user32.dll" _
(ByVal hwnd As Long, _
ByVal nPosition As Long, _
ByVal uflags As Long) As Long
Sub LockForm()
Dim hMenu As Long
Dim hwnd As Long
Dim RetVal As Long
Const MF_BYCOMMAND As Long = &H0&
Const SC_MOVE As Long = &HF010
hwnd = GetForegroundWindow()
hMenu = GetSystemMenu(hwnd, 0&)
RetVal = DeleteMenu(hMenu, SC_MOVE, MF_BYCOMMAND)
RetVal = DrawMenuBar(hwnd)
End Sub
Private Sub UserForm_Activate()
Call LockForm
End Sub
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel
Postado : 04/07/2012 6:05 am