How I can do from my Form code to not appear in the TaskBar?
This runtime does not work ...Code:Form1.ShowInTaskbar = False
SetWindowLong ()?
Thanks
Printable View
How I can do from my Form code to not appear in the TaskBar?
This runtime does not work ...Code:Form1.ShowInTaskbar = False
SetWindowLong ()?
Thanks
Set the ShowInTaskbar property to False. You can only do this in design time as far as I know.
If you want to do it during run time, then you can use this.
vb Code:
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 SW_SHOW = 5 Private Const SW_HIDE = 0 Private Const GWL_EXSTYLE = (-20) Private Const WS_EX_APPWINDOW = &H40000 Public Sub ShownInTaskBar(ByVal hwnd As Long, Optional bShow As Boolean = True) Dim lExStyles As Long lExStyles = GetWindowLong(hwnd, GWL_EXSTYLE) If bShow Xor (lExStyles And WS_EX_APPWINDOW) = 0 Then Exit Sub ShowWindow hwnd, SW_HIDE SetWindowLong hwnd, GWL_EXSTYLE, lExStyles Xor WS_EX_APPWINDOW ShowWindow hwnd, SW_SHOW End Sub Private Sub Command1_Click() ShownInTaskBar Me.hwnd, False End Sub
Thanks, but i put this and it doesnt works...
I have been searching...vb Code:
Form1.ShowInTaskbar = False
Thanks...
As Chris001 said, the ShowInTaskbar property can only be set at design time, in the Properties window for the form. In code the property is read only, you can't set it through code like that.