ShowInTaskBar za běhu aplikace

Postup:
Do projektu přidejte modul a v něm deklarujte:

Public Declare Function GetWindowLong Lib "user32" Alias _
  "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias _
  "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _
  ByVal dwNewLong As Long) As Long
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd _
  As Long, ByVal nCmdShow As Long) As Long
 
Public Const SW_HIDE = 0
Public Const SW_SHOW = 5
 
Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_TOOLWINDOW = &H80&
 
Public Sub setShowInTaskbar(Visible As Boolean, hwnd As Long)

    Dim L As Long
    L = ShowWindow(hwnd, SW_HIDE)
    DoEvents
    L = SetWindowLong(hwnd, GWL_EXSTYLE, IIf(Visible,_
        -WS_EX_TOOLWINDOW, WS_EX_TOOLWINDOW))
    DoEvents
    L = ShowWindow(hwnd, SW_SHOW)

End Sub

Na formulář přidejte dvě tlačítka a na jejich událost Click:
Private Sub Command1_Click()

   Call setShowInTaskbar(True, Me.hwnd)

End Sub
 
Private Sub Command2_Click()

   Call setShowInTaskbar(False, Me.hwnd)

End Sub

Zpět

Autor: The Bozena

iReklama.cz - nový reklamní systém
iReklama.cz - nový reklamní systém