Built in the taskbar, there is no Item, which (reproduced)

xiaoxiao2021-03-06  67

There is an item on each program on the Taskbar, pressing the item, the corresponding program is active.

In fact, these program items on Taskbar are done with Tab Control, so if we can get Taskbar

The Tab Control (Systab) hwnd, we can freely delete it on Item.

1. When an application is started, in addition to sending the WM_ACTIVE wakes up the main window of its own, it will also notify

SYSTAB (Send ABM_ACTIVATE) Creates the button and icon on the Taskbar)

2. To let an application, press ALT-TAB that cannot be switched, you must first change the window type of this application.

For ToolWindow; however, in VB can reach the same effect with Show VBModal.

Option expedition

Private Declare Function FindWindow Lib "User32" Alias ​​"FindWindowa" (_

Byval lpclassname as string, _

Byval lpwindowname as string) As long

Private Declare Function FindWindowEx Lib "User32" Alias ​​"FindWindowexa" (_

Byval hwndparent as long, _

Byval hwndchild as long, _

Byval lpclassname as string, _

Byval lpwindowname as string) As long

Const gwl_exstyle = (-20)

Const WS_EX_TOOLWINDOW = & H80

Private Declare Function SetWindowlong Lib "User32" Alias ​​"Setwindowlonga" (Byval Nindex As Long, BYVAL DWNEWLONG AS Long) As long

Private Declare Function SendMessage LIB "User32" Alias ​​"SendMessagea" (Byval Hwnd As Long, Byval WParam As Long, LParam As Any) As long

Private const tcm_first = & h1300 'Tab Control Messages

Private const tcm_getimagelist = (TCM_First 2)

Private const tcm_setimagelist = (TCM_First 3)

Private const tcm_getitemcount = (TCM_First 4)

Private const tcm_getitema = (TCM_First 5)

Private const tcm_getitemw = (TCM_First 60)

Private const tcm_setitema = (TCM_First 6)

Private const tcm_setitemw = (TCM_First 61)

Private const tcm_insertitema = (TCM_First 7)

Private const tcm_insertitemw = (TCM_First 62) private const tcm_deletetem = (TCM_First 8)

Private const tcm_deleteallitems = (TCM_First 9)

Private const tcm_getitemRect = (TCM_First 10)

Private const tcm_getcursel = (TCM_First 11)

Private const tcm_setcursel = (TCM_First 12)

Private const tcm_hittest = (TCM_First 13)

Private const tcm_setitextra = (TCM_First 14)

Private const tcm_adjustRect = (TCM_First 40)

Private const tcm_setitemsize = (TCM_First 41)

Private const tcm_removeimage = (TCM_First 42)

Private const tcm_setpadding = (TCM_First 43)

Private const tcm_getrowcount = (TCM_First 44)

Private const tcm_gettooltips = (TCM_First 45)

Private const tcm_settooltips = (TCM_First 46)

Private const tcm_getcurfocus = (TCM_First 47)

Private const tcm_setcurfocus = (TCM_First 48)

Private const TCM_SETMINTABWIDTH = (TCM_FIRST 49)

Private const tcm_deselectall = (TCM_First 50)

PRIVATE CONST TCM_HighlightItem = (TCM_First 51)

Private const tcm_setextendedStyle = (TCM_First 52)

Private const tcm_getextendedStyle = (TCM_First 53)

Private const tcm_setunicodeformat = & h2005

Private const TCM_GETUNICODEFORMAT = & H2006

Private sub flow_load ()

DIM LRETURN AS Long

DIM LHWND As Long

Lreturn = FindWindow ("shell_traywnd", vbnullstring) 'First find shell TRAY HANDLE

Lreturn = FindWindowEx (Lreturn, 0, "Mstaskswwclass", vbnullstring) 'Looking for its Child

LHWND = FindWindowEx (Lreturn, 0, "SystabControl32", vbnullstring) 'It turned out to be this one

Me.show

'Doevents

Me.visible = false

'Setting Window Extend Style to ToolWindow, press Alt-Tab to switch to

Lreturn = setWindowlong (me.hwnd, gwl_exstyle, ws_ex_toolwindow)

'You should set the properties of the Visible to make the API of the Window Style to enable

Me.visible = true

'Delete the last Item on SYSTAB

Lreturn = sendMessage (lhwnd, tcm_getimemcount, 0, byval 0)

Lreturn = sendMessage (lhwnd, tcm_deleteitem, lreturn - 1, byval 0)

End Sub

转载请注明原文地址:https://www.9cbs.com/read-120298.html

New Post(0)