Toolbar on the Windows XP and Vista taskbar

I have created a toolbar that I want to include from a systray application written in C #, the actual enabling of the toolbar is done from the C ++ part using [DLLImport].

The current I'm using:

SHLoadInProc(__uuidof(MyBandLoader))

      

but this fails on Vista (SHLoadInProc is no longer implemented) and on Windows XP SP2 with IE6 (Quick Launch disappears after reboot).

On Vista I tried using: CocreateInstance () and BandSite-> AddBand (), but using the dll toolbar guide gave me either a segmentation fault or an address bar.

Is there any other way to enable the toolbar from another program on XP and Vista?

+1


source to share


3 answers


Vista introduces a new, poorly documented interface called ITrayDeskBand.

Instantiate this with CoCreateInstance and then call ShowDeskBand ([CLSID of your toolbar]) on the returned pointer (in C ++ - I'm not sure how you would instantiate all the appropriate bits for PInvoke in C # - it might be easier to write simple C ++ dll to expose this function)



This only works on Vista, but on XP you need to continue with the SHLoadInProc method described above, so you need to test the OS version and complete the appropriate task.

Be careful if you lift code from this codex article - it's full of subtle bugs, although many of them are discussed in the comments

+1


source


I used this one, but it only says you should create a toolbar, not how to enable it from another program.



0


source


You cannot use .Net to create any COM objects inside the Explorer process. It just doesn't work if there is another .net component using a different version of the framework already loaded into the explorers process. Only one .net structure per process. MS should never have tried samples about desktop scoping development in any .net language.

The only way for Vista is to use the ITrayDeskBand interface to display the toolbar. However, this will display a confirmation window for the user and he can opt out of the displayed toolbar.

0


source







All Articles