ich möchte gerne das rote X oben rechts bei Userformen (Zum Schließen) entfernt haben.
Außerdem wäre es gut, wenn die Userformen Unverschiebbar wären.
Danke für jede Antwort
-Mark-
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
Const WS_MAXIMIZEBOX = &H10000
Const GWL_STYLE = (-16)
Sub Kreuz_weg(objUF As Object)
Dim hWnd As Long, lStyle As Long
Select Case Int(Val(Application.Version))
Case 8
hWnd = FindWindow("ThunderXFrame", objUF.Caption)
Case 9 To 11
hWnd = FindWindow("ThunderDFrame", objUF.Caption)
End Select
lStyle = GetWindowLong(hWnd, 0)
SetWindowLong hWnd, GWL_STYLE, lStyle Or WS_MAXIMIZEBOX
End Sub
Private Sub CommandButton1_Click()
' Button im Userform damit man es wieder schliessen kann, NICHT Vergessen
Unload Me
End Sub
Private Sub UserForm_Initialize()
Call Kreuz_weg(Me)
End Sub
Private Sub UserForm_Activate()
Dim lHwnd As Long, lStyle As Long
lHwnd = FindWindow("ThunderDFrame", Me.Caption)
SetWindowLong lHwnd, GWL_STYLE, GetWindowLong(lHwnd, GWL_STYLE) And Not WS_SYSMENU
DrawMenuBar lHwnd
End Sub