Ich habe dank diesem Forum ein Klassenmodul gefunden, mittels dem man einer UserForm oben rechts die Symbole für Maximieren, Minimieren und Schliessen geben kann:
Option Explicit
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 ShowWindow Lib "user32" (ByVal _
hwnd As Long, ByVal nCmdShow 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 Const GWL_STYLE As Long = (-16)
Private Const WS_THICKFRAME As Long = &H40000
Private Const WS_SYSMENU As Long = &H80000
Private Const WS_MINIMIZEBOX As Long = &H20000
Private m_objUserForm As Object
Private m_hWndForm As Long
Enum enuWinStat
Minimieren = vbMinimizedFocus
Normal = vbNormal
End Enum
Public Property Set Form(ByVal objForm As Object)
Dim nStyle As Long
Set m_objUserForm = objForm
m_hWndForm = FindWindow(vbNullString, m_objUserForm.Caption)
If m_hWndForm 0 Then
nStyle = GetWindowLong(m_hWndForm, GWL_STYLE)
nStyle = nStyle Or WS_THICKFRAME Or WS_SYSMENU Or WS_MINIMIZEBOX
SetWindowLong m_hWndForm, GWL_STYLE, nStyle
DrawMenuBar m_hWndForm
SetFocus m_hWndForm
End If
End Property
Public Property Let WinState_(Show_ As enuWinStat)
ShowWindow m_hWndForm, Show_
End Property
Diesen Code hab ich sauber in ein Klassenmodul gepackt.
Nun aber meine Frage:
Was muss ich in meiner UserForm1 noch einbauen, damit die Symbole (Minimieren, Maximieren, _
Schliessen) auch oben rechts dargestellt werden ?
Habe das über folgenden Code Probiert, geht aber leider nicht:
Sub UserForm1_Activate()
'######## UserForm - Steuerung / Klassen --> Aktivierung der UserForm
Set objUserForm = New UserFormular_Steuerung
Set objUserForm.Form = Me
End Sub
Besten Dank für Eure Hilfe !