Jump to content


Photo

Using COM-Object "Task Bar Communication" in Win7


  • Please log in to reply
7 replies to this topic

#1 hoppfrosch

hoppfrosch
  • Members
  • 339 posts

Posted 16 February 2011 - 08:15 AM

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 ...

#2 hoppfrosch

hoppfrosch
  • Members
  • 339 posts

Posted 23 February 2011 - 07:44 AM

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!

#3 hoppfrosch

hoppfrosch
  • Members
  • 339 posts

Posted 23 February 2011 - 08:24 AM

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?

#4 maul.esel

maul.esel
  • Guests

Posted 27 February 2011 - 06:58 PM

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

#5 Lexikos

Lexikos
  • Administrators
  • 8844 posts

Posted 28 February 2011 - 12:31 AM

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, ...)


#6 hoppfrosch

hoppfrosch
  • Members
  • 339 posts

Posted 28 February 2011 - 11:47 AM

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 ...

#7 Lexikos

Lexikos
  • Administrators
  • 8844 posts

Posted 01 March 2011 - 11:33 AM

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).

#8 hoppfrosch

hoppfrosch
  • Members
  • 339 posts

Posted 01 March 2011 - 12:27 PM

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 ....