Questo elimina la solo la x.
Nel modulo di codice della UserForm:
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 FindWindow _
Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long
Private Sub UserForm_Initialize()
SetWindowLong FindWindow( _
vbNullString, Me.Caption), _
-16, -2067791744
End Sub
Questo elimina tutta la barra del titolo:
In un Modulo di classe(in questo esempio: clsForm)
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_CAPTION As Long = &HC00000
Public Property Set Form(oForm As Object)
Dim lStyle As Long
Dim hWndForm As Long
If Val(Application.Version) < 9 Then
hWndForm = FindWindow( _
"ThunderXFrame", oForm.Caption)
Else
hWndForm = FindWindow( _
"ThunderDFrame", oForm.Caption)
End If
lStyle = GetWindowLong(hWndForm, GWL_STYLE)
lStyle = lStyle And Not WS_CAPTION
SetWindowLong hWndForm, GWL_STYLE, lStyle
DrawMenuBar hWndForm
End Property
Nel modulo di codice della UserForm:
Dim objForm As New clsForm
Private Sub UserForm_Initialize()
Set objForm.Form = UserForm1
With Me
.BorderStyle = fmBorderStyleSingle
End With
End Sub
Private Sub UserForm_Terminate()
Set objForm = Nothing
End Sub
Crea poi qualcosa per gestire la chiusura della
UserForm.
P.S. Esempio di utilizzo delle *stranezze/moduli di classe*... ;-)
--
---------------------------
Mauro Gamberini
http://www.riolab.org/
http://blog.maurogsc.eu/
Ciao Mauro.
Molto esauriente.
Tante, tante grazie.
Ciao.
Nunzio.
>
>