Any plans to add support for the Windows 7 taskbar?
I am not a big fan of OOP style of proramming, but luckily COM object stuff involved for the simple Windows 7 taskbar support is quite simple to do in the 'old school style'.
Steps involved (in MiniBASIC syntax):
First we need to define some GUIDs:
GUID CLSID_TaskbarList
DEFINE_GUID(CLSID_TaskbarList,0x56FDF344,0xFD6D,0x11D0,0x95,0x8A,0x00,0x60,0x97,0xC9,0xA0,0x90)
GUID IID_ITaskbarList3
DEFINE_GUID(IID_ITaskbarList3,0xEA1AFB91,0x9E28,0x4B86,0x90,0xE9,0x9E,0x9F,0x8A,0x5E,0xEF,0xAF)
Then we register a window message to inform us when the taskbar is created. we also declare a pointer to taskbar list COM object:
uint WM_TASKBARBUTTONCREATED = -1
WM_TASKBARBUTTONCREATED = RegisterWindowMessage('TaskbarButtonCreated')
pointer pTaskBar
Next, in window procedure we handle the 'TaskbarButtonCreated' message by initializing the taskbarlist COM object:
CoInitialize(NULL)
' Next get the pointer to taskbar list COM object
CoCreateInstance(&CLSID_TaskbarList,0, CLSCTX_INPROC_SERVER, &IID_ITaskbarList3, &pTaskBar)
' Next initialize taskbar list COM object
M_CALL(pTaskBar, 12, hwnd) ' call taskbar list HrInit method
Now we have a pointer to the COM object and you probably noticed the M_CALL() function and wonder what it does?
It turns out we can do COM method calls using the COM object pointer and the offset of a method:
func M_CALL(pointer ObjPtr, uint moffset, opt uint v1, opt uint v2, opt uint v3, opt uint v4, opt uint v5), int
int ret = 0
##asm
push dword [ebp+32]
push dword [ebp+28]
push dword [ebp+24]
push dword [ebp+20]
push dword [ebp+16]
mov ecx, [ebp+12]
mov eax, [ebp+8]
push eax
mov eax, [eax]
call dword [eax+ecx]
mov [ebp-4], eax
##endasm
return ret
endf
You probably wonder, how we know the method offsets and why the HrInit method is located at offset 12? I am no expert at COM, but I think it's because the first three members of the VTable must be: QueryInterfacePtr, AddRefPtr and ReleasePtr. As each member takes up four bytes, the first real method is located at offset 12. You can just look at the interface definition and do the math to figure out the offsets for the rest of the available methods.
If there is interest, I can write a full featured sample demoing the Windows 7 taskbar progress bar in action...