Ich hoffe ihr könnt mir weiterhelfen. Ich möchte die Schließen-Schaltfläche (X) einer Userform ausblenden und die Userform fixieren.
Ich habe mir für beides bereits den Code rausgesucht, ich bekomme es auch zum laufen, aber immer nur eins von beiden. Es soll aber beiden gehen.
hier der Code den ich habe:
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 DrawMenuBar Lib "user32" (ByVal _
hwnd As Long) As Long
Private Const GWL_STYLE As Long = -16
Private Const WS_SYSMENU As Long = &H80000
Private hwndForm As Long
Private bCloseBtn As Boolean
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 Const MF_BYCOMMAND = &H0
Private Const SC_MOVE = &HF010
'############### So jetzt kommt das Problem #########################
Dim hwndForm As Long
Dim hwndMenu As Long
hwndForm = FindWindow(vbNullString, Me.Caption)
If hwndForm <> 0 Then
hwndMenu = GetSystemMenu(hwndForm, 0)
If hwndMenu <> 0 Then
DeleteMenu hwndMenu, SC_MOVE, MF_BYCOMMAND
End If
End If
---------------------------------------------------------
If Val(Application.Version) >= 9 Then
hwndForm = FindWindow("ThunderDFrame", Me.Caption)
Else
hwndForm = FindWindow("ThunderXFrame", Me.Caption)
End If
bCloseBtn = False
SetUserFormStyle
Benutze ich den Code so ist die Userform fixiert, aber das X ist da.
Setzt ich den unteren Block nach oben, dann ist das X weg, aber die Userform läßt sich verschieben.
Wie bekomme ich beiden zu laufen. ?
Harry