Option Explicit
#If Win64 Then
Private Declare PtrSafe Function GetWindowLongPtr _
Lib "user32.dll" Alias "GetWindowLongPtrA" ( _
ByVal hwnd As LongPtr, _
ByVal nIndex As Long) As LongPtr
Private Declare PtrSafe Function SetWindowLongPtr _
Lib "user32.dll" Alias "SetWindowLongPtrA" ( _
ByVal hwnd As LongPtr, _
ByVal nIndex As Long, _
ByVal dwNewLong As LongPtr) As LongPtr
Private Declare PtrSafe Function FindWindowA _
Lib "user32.dll" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As LongPtr
Private Declare PtrSafe Function DrawMenuBar _
Lib "user32.dll" ( _
ByVal hwnd As LongPtr) As Long
#Else
Private Declare Function GetWindowLongPtr _
Lib "user32.dll" Alias "GetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long) As Long
Private Declare Function SetWindowLongPtr _
Lib "user32.dll" Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function FindWindowA _
Lib "user32.dll" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function DrawMenuBar _
Lib "user32.dll" ( _
ByVal hwnd As Long) As Long
#End If
Private Sub UserForm_Initialize()
CreateMenu
End Sub
Private Sub CreateMenu()
Const GWL_STYLE As Long = -16
Const WS_SYSMENU As Long = &H80000
Const WS_MINIMIZEBOX As Long = &H20000
Const WS_MAXIMIZEBOX As Long = &H10000
#If Win64 Then
Dim lngFrmWndHdl As LongPtr
Dim lngStyle As LongPtr
#Else
Dim lngFrmWndHdl As Long
Dim lngStyle As Long
#End If
lngFrmWndHdl = FindWindowA(vbNullString, Me.Caption)
lngStyle = GetWindowLongPtr(lngFrmWndHdl, GWL_STYLE)
lngStyle = lngStyle Or WS_SYSMENU 'Add SystemMenu
lngStyle = lngStyle Or WS_MINIMIZEBOX 'Add MinimizeBox
lngStyle = lngStyle Or WS_MAXIMIZEBOX 'Add MaximizeBox
SetWindowLongPtr lngFrmWndHdl, GWL_STYLE, lngStyle
DrawMenuBar lngFrmWndHdl
End Sub
Showballoontooltip Ve Access
Konuyu Okuyanlar: 1 Ziyaretçi