Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Using COM-Object "Task Bar Communication" in Win7


  • Please log in to reply
7 replies to this topic
hoppfrosch
  • Members
  • 399 posts
  • Last active: Feb 26 2016 05:31 AM
  • Joined: 25 Jan 2006
Hi there,

I'm trying to get something done with COM objects - esp. using ITaskbarList on WIN7. My final goal is to get some overlay icons over Taskbar-Items.

As I'm a noob in COM programming, I need some initial help to get into it.

Here is what I tried - it simply should display one taskbar button after the other as active ...
; Autohotkey_L:

COM_CoInitialize()

$CLSID_ITaskBarlist := "{56FDF344-FD6D-11D0-958A-006097C9A090}"
$IID_ITaskbarList  := "{56FDF342-FD6D-11d0-958A-006097C9A090}"

piTBL := COM_CreateObject($CLSID_ITaskbarList, $IID_ITaskBarlist)
piTBL.HrInit()

WinGet, id, list,,, Program Manager
Loop, %id%
{
    this_id := id%A_Index%
    piTBL.ActivateTab(this_id)
    Sleep, 5000
}

COM_CoUninitialize()
COM_Release(piTBL)

But this does not work - I tried several things and searched the internet for help, but had no success yet.

Could anybody give initial help please?

BTW: I'm using latest Autohotkey_L ...

Hoppfrosch

---------

Here are some helpful links:
ITaskBarList:http://msdn.microsof...2(v=VS.85).aspx
ITaskBarList2: http://msdn.microsof...8(v=VS.85).aspx
ITaskBarList3: http://msdn.microsof...692(VS.85).aspx
ITaskBarList4: http://msdn.microsof...0(v=VS.85).aspx
Windows 7 Taskbar: Overlay Icons and Progress Bars: http://blogs.microso...gress-bars.aspx

Edit: Corrected typo within sourcecode ...

hoppfrosch
  • Members
  • 399 posts
  • Last active: Feb 26 2016 05:31 AM
  • Joined: 25 Jan 2006
A few more findings on my problem:

* ITaskbarList is a COM Interface and not a COM Object
* OLEView says for Interface ITaskBarList:
Interface = 
	{56FDF342-FD6D-11D0-958A-006097C9A090} = ITaskbarList
		NumMethods = 8
		ProxyStubClsid32 = {C90250F3-4D7D-4991-9B69-A5C5BC1C2AE6}
CLSID = 
	{C90250F3-4D7D-4991-9B69-A5C5BC1C2AE6} = PSFactoryBuffer
		InProcServer32 [ThreadingModel] = Both
		InProcServer32 [<no name>] = C:\Windows\SysWOW64\actxprxy.dll

As far as I understand, the COM object, implementing my desired Interface is PSFactoryBuffer ...

But I have no success using the PSFactoryBuffer as COM object via ComObjCreate() - since this seems to be a factory (as the name implies) and not a concrete implementation ...

Any hints/links how to use a COM interface rather than a COM object within autohotkey? Tried to find anything in the forum but failed ....


Any help welcome!

hoppfrosch
  • Members
  • 399 posts
  • Last active: Feb 26 2016 05:31 AM
  • Joined: 25 Jan 2006
On the other hand, there seems to be a COM object Task Bar Communication with CLSID {56FDF344-FD6D-11d0-958A-006097C9A090} which owns the ITaskBarList Interface ...

Doing the following with AHK_L:

$CLSID_TaskBarlist := "{56FDF344-FD6D-11D0-958A-006097C9A090}"
TBL := ComObjCreate($CLSID_TaskBarlist)

leads to an errorbox, saying:

Error: 0x80004002 - Interface not supported


What does this mean in practice?

maul.esel
  • Guests
  • Last active:
  • Joined: --
Look at http://www.autohotke...topic50817.html
I think it uses ITaskbarList(3) too, but I don't understand anything. Maybe you do.

Regards
maul.esel

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

What does this mean in practice?

That object does not support the IDispatch interface which would allow scripts to use it more transparently. You need to use the ITaskbarList interface, which means making VTable calls like the ones in the script maul.esel linked to. To do this you need to know the layout of the interface's VTable; i.e. the index of each function within the VTable. (The order listed on MSDN is often different; the interface/VTable is defined in the Windows SDK.)
DllCall(NumGet(NumGet(piTBL+0)+[color=darkred]index[/color]*A_PtrSize), "ptr", piTBL, ...)


hoppfrosch
  • Members
  • 399 posts
  • Last active: Feb 26 2016 05:31 AM
  • Joined: 25 Jan 2006
Thanks maul.esel & Lexikos,

I'll try to understand the Taskbar-Progressbar example - that's exactly what I'm looked for, but failed to find ...

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
Note that in your first post, $CLSID_iTaskbarList should be $CLSID_TaskBarlist. If you correct that, it should create the object successfully (but you'll still have to interact with it via DllCall). Maybe you already noticed this. Btw, #Warn would alert you to that error (but unfortunately COM.ahk also raises a few warnings).

hoppfrosch
  • Members
  • 399 posts
  • Last active: Feb 26 2016 05:31 AM
  • Joined: 25 Jan 2006

Note that in your first post, $CLSID_iTaskbarList should be $CLSID_TaskBarlist. If you correct that, it should create the object successfully (but you'll still have to interact with it via DllCall). Maybe you already noticed this..


Thanks for pointing this out - already noticed it within my further inverstigations. Gonna correct the first post ....