Does anyone know how to make Taskbar buttons appear/disappear?
Posted on 2003-11-19 19:21:25 by msmith
Insert & remove buttons
Posted on 2003-11-20 00:13:12 by greenant
Hi msmith,

This works:

Unknown STRUCT

QueryInterface DWORD ?
AddRef DWORD ?
Release DWORD ?
Unknown ends

ITaskbarList STRUCT
IUnknown Unknown <>

HrInit DWORD ?
AddTab DWORD ?
DeleteTab DWORD ?
ActivateTab DWORD ?
SetActiveAlt DWORD ?
ITaskbarList ends

.const
sCLSID_ITaskbarList textequ <{056fdf344H, 0fd6dH, 011D0H,\
{095H, 08ah, 000H, 060H, 097H, 0c9H, 0a0H, 090H}}>

sIID_ITaskbarList textequ <{056FDF342H, 0FD6DH, 011D0H,\
{095H, 08AH, 000H, 060H, 097H, 0C9H, 0A0H, 090H}}>

.data
CLSID_ITaskbarList GUID sCLSID_ITaskbarList
IID_ITaskbarList GUID sIID_ITaskbarList

.code
ShowTab proc hWnd:DWORD,fShow:DWORD
LOCAL ptb :DWORD

invoke CoCreateInstance,ADDR CLSID_ITaskbarList,NULL,CLSCTX_INPROC_SERVER,\
ADDR IID_ITaskbarList,ADDR ptb
.IF eax != S_OK
mov eax,-1
ret
.endif

push ptb
mov edi,ptb
mov edi,[edi]
call [edi].ITaskbarList.HrInit
.IF eax != S_OK
push ptb
call [edi].ITaskbarList.IUnknown.Release
mov eax,-1
ret
.endif

push hWnd
push ptb
.IF fShow
call [edi].ITaskbarList.AddTab
.ELSE
call [edi].ITaskbarList.DeleteTab
.ENDIF
.IF eax != S_OK
push ptb
call [edi].ITaskbarList.IUnknown.Release
mov eax,-1
ret
.endif

push ptb
call [edi].ITaskbarList.IUnknown.Release

xor eax,eax

ret
ShowTab endp


<Edit>I didn't see that you wanted to add tabs as well, set the fShow flag to TRUE to show a tab, FALSE to remove it</Edit>

Slightly shortened
Posted on 2003-11-20 11:13:11 by donkey
Excuse me. I read Toolbar not TaskBar. Forget my reply
Posted on 2003-11-20 12:32:37 by greenant
Hi msmith,

The skeleton I used was for another interface call, I have removed the redundant calls to get the interface. The original skeleton used multiple interfaces this only uses one so they are not necessary and it's now much shorter.
Posted on 2003-11-20 12:38:33 by donkey
Hi Donkey,

Thanks as always.

The main problem with you fix on this one is translating MASM to FASM :)
Posted on 2003-11-20 14:15:17 by msmith

Hi Donkey,

Thanks as always.

The main problem with you fix on this one is translating MASM to FASM :)

Your very welcome

It's not so bad, I don't use any of the COM preprocessors or macros so they could be a lot worse :grin:
Posted on 2003-11-20 14:19:28 by donkey