grazie alka per l'aiuto
ma non pensavo fosse così complicato
utilizzare questo comando in modo "dinamico"...
dato che tra le proprietà della FORM è semplificato.
Riporto il codice suggerito:
codice:
'Realizzare 2 command buttons con questi Nomi 'cmdToggle' e 'cmdCheck'
Option Explicit
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 ShowWindow Lib "user32"
(ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_APPWINDOW = &H40000
Const SW_HIDE = 0
Const SW_NORMAL = 1
Private Sub ShowInTheTaskbar(hwnd As Long, bShow As Boolean)
Dim lStyle As Long
ShowWindow hwnd, SW_HIDE
lStyle = GetWindowLong(hwnd, GWL_EXSTYLE)
If bShow = False Then
If lStyle And WS_EX_APPWINDOW Then
lStyle = lStyle - WS_EX_APPWINDOW
End If
Else
lStyle = lStyle Or WS_EX_APPWINDOW
End If
SetWindowLong hwnd, GWL_EXSTYLE, lStyle
App.TaskVisible = bShow
ShowWindow hwnd, SW_NORMAL
End Sub
Private Function IsVisibleInTheTaskbar(hwnd As Long) As Boolean
Dim lStyle As Long
lStyle = GetWindowLong(hwnd, GWL_EXSTYLE)
If lStyle And WS_EX_APPWINDOW Then
IsVisibleInTheTaskbar = True
End If
End Function
Private Sub cmdToggle_Click()
Static bVisible As Boolean
bVisible = Not IsVisibleInTheTaskbar(Me.hwnd)
ShowInTheTaskbar Me.hwnd, bVisible
End Sub
Private Sub Form_Load()
cmdToggle.Caption = "Leva visibilità"
cmdCheck.Caption = "Controlla visibilità"
End Sub
grazie ancora,
cerchero una alternativa al SUO uso.