Thomas Risi Softwareentwicklung
Addins - Datenbanklösungen - Komponenten - RTDServer - WebServices
UserForm ohne Titelleiste
Eine UserForm ohne Titelleiste anzeigen kein Problem ...
Quellcode für die UserForm (mit einem CommandButton) ...
Option Explicit
Private Declare Function DrawMenuBar Lib "User32" ( _
ByVal hwnd As Long) As Long
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_BORDER As Long = &H800000
Const WS_CAPTION As Long = &HC00000
Const WS_EX_WINDOWEDGE As Long = &H100
Const GWL_STYLE As Long = (-16)
Const GWL_EXSTYLE As Long = (-20)
Dim hwnd&
Private Function GetHandleUF(uf As MSForms.UserForm) As Long
GetHandleUF = IIf(Int(Val(Application.Version)) < 9, _
FindWindow("ThunderXFrame", uf.Caption), FindWindow("ThunderDFrame", uf.Caption))
End Function
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
hwnd = GetHandleUF(Me)
Me.BackColor = &H80FFFF
Call SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) And Not WS_CAPTION)
Call SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_STYLE) And WS_EX_WINDOWEDGE)
Call DrawMenuBar(hwnd)
End Sub
© 2001 -
by Thomas Risi