|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
jalih
Joined: 30 Jul 2012 Posts: 196
|
Posted: Wed Jun 26, 2013 9:02 pm Post subject: Windows 7 Taskbar |
|
|
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:
Code: |
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:
Code: |
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:
Code: |
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:
Code: |
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... |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Thu Jun 27, 2013 7:11 am Post subject: |
|
|
Jalih
There are no plans at the moment to support the Windows 7 taskbar.
Note that all future development will aim to avoid assembler code in order to reduce the hassle of maintaining both 32 and 64 bit architecture. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Thu Jun 27, 2013 11:25 am Post subject: |
|
|
Paul, Jalih,
I must admit that Jalih's post took me to a new area that I didn't know existed in terms of taskbar functionality. It does seem a shame not to have things available when someone offers to develop them, and someone else might gratefully use them, even if there are limits to that functionality.
Is not one answer to this to have a new section of the forum where users could post interesting (and working!) subroutines etc to do things that Clearwin+ does not do? (Like Jalih's suggestions for the taskbar)? (Simdem / Simfit is a bit like this).
I'm using a terrific routine of this sort that controls the opacity of a window which someone posted years ago. I make my startup 'splash' gradually fade away with it.
However, perhaps it would need to allow longer messages than the forum does currently.
Jalih, Do you do assembly programming inline with your Fortran using CODE ... EDOC?
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Thu Jun 27, 2013 4:46 pm Post subject: |
|
|
Eddie
My apologies but my reply was not intended to restrict Jalih in any way but just to be open about our involvement at the present time. We have many demands on our time and we need to be realistic about priorities and when we can deliver. |
|
Back to top |
|
|
jalih
Joined: 30 Jul 2012 Posts: 196
|
Posted: Fri Jun 28, 2013 8:41 pm Post subject: Re: |
|
|
LitusSaxonicum wrote: |
Jalih, Do you do assembly programming inline with your Fortran using CODE ... EDOC?
|
No, I usually write my external routines in MiniBASIC as it's using the NASM assembler for inline assembly.
I decided to write a simple FTN95 callable Windows 7 Taskbar library. All methods in the ITaskbarList3 interface will simply be callable as functions and take the pointer to taskbar list COM object as the first parameter. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Fri Jun 28, 2013 10:29 pm Post subject: |
|
|
Paul,
I didn't think that you meant to discourage Jalih, so no apology needed - I'm sure that he appreciates how much your team have on their plate already (I do).
My suggestions were offered, as always and perhaps naively, in the hope that we can all benefit from the inventiveness and generosity of other forum users.
Eddie |
|
Back to top |
|
|
jalih
Joined: 30 Jul 2012 Posts: 196
|
Posted: Sun Jun 30, 2013 10:24 am Post subject: |
|
|
I have been making some progress. Most of the ITaskBarList3 methods have now been wrapped into flat interface as simple functions.
Below is a picture to demonstrate the Taskbar progress bar in action. I added progress counter as icon overlay and it's created dynamically.
Taskbar progress bar in action |
|
Back to top |
|
|
jalih
Joined: 30 Jul 2012 Posts: 196
|
Posted: Sun Jun 30, 2013 6:57 pm Post subject: |
|
|
I made a simple FTN95 example project to play with...
Available here |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|