Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Eliminare barra

72 views
Skip to first unread message

Nunzio

unread,
May 25, 2009, 5:28:25 AM5/25/09
to
Ciao.
E' possibile eliminare la barra di stato con la X ( per la chiusura del
form)
in un UserForm1.
Per piacere potete dirmi come fare.
Un sgrazie a tutti.
Ciao.
Nunzio.

Mauro Gamberini

unread,
May 25, 2009, 5:50:48 AM5/25/09
to
> E' possibile eliminare la barra di stato con la X ( per la chiusura del
> form)
> in un UserForm1.
> Per piacere potete dirmi come fare.
>

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/


Nunzio

unread,
May 25, 2009, 3:04:20 PM5/25/09
to

"Mauro Gamberini" <maurogsc...@RIMUOVEREaliceposta.it> ha scritto nel
messaggio news:uQwGp6R3...@TK2MSFTNGP06.phx.gbl...


Ciao Mauro.
Molto esauriente.
Tante, tante grazie.
Ciao.
Nunzio.
>
>


0 new messages