views:

451

answers:

4

I am using the Windows API Code Pack for Microsoft .NET Framework to try out of some of the new UI features of the Win7 taskbar. I am coding in C#.

I have a question regarding jumplists. All of the sample code provided assumes that the entries on the jump list are used to call out to run a particular application or open a document, e.g. a text document in a MRU list or run mspaint.exe.

I would like to implement some items which allow me to set state in my own application (i.e. the app which is interacting with the taskbar). MSN Messenger does this, for example, when you can set your status (Busy, Offline etc.).

Try as I might, I cannot create a JUmpListItem or JumpListLink to behave in this way - it treats them as applications or documents.

Does anyone have any samples of how to create an item which raises an event in the same application that created it? I am sure it is simple but I am being very daft.

Many thanks for your help.

A: 

Using the TaskBarDemo, to open an item created by your application would have to be referenced, ie if your program created a PDF file you would do this:

jumpList.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "C:\\Program Files\\Adobe\\Reader 9.0\\Reader\\AcroRD32.exe"), "Open Adobe Reader")
        {
            IconReference = new IconReference(Path.Combine(systemFolder, "C:\\Program Files\\Adobe\\Reader 9.0\\Reader\\AcroRD32.exe"), 0)
        });

Otherwise you would have to ensure that your application registered file associations, for recent or frequent items.

I had a few problems with jumplists with the API Pack, i now use VS 2010 Beta 2 and let shell handle the jumplists.

Hope this is helpfull.

Dev
Thanks, but I do not want to instantiate anything externally, I simply want to send an event within my application - rather like a pretty context menu really. Is this possible with Jumplists?
mrbouffant
A: 

This article on CodeProject might be of help here.

Hope this helps, Best regards, Tom.

tommieb75
+1  A: 

I believe what you'd want to do is to call your application with a special set of flags (i.e. launch the executable with certain arguments). At application start up, you'd check to see what flags are set, then send a message to the main instance of the application and then exit out of the new instance.

Kitsune
A: 

These tasks are some sort of IShellLink. Then, you should call ICustomDestinationList's AddUserTasks. Look up samples in Windows 7 Training Kit.

zengkun100