简体   繁体   English

Windows 7任务栏 - 跳转列表,jumplistlink和jumplistitem

[英]Windows 7 taskbar - jumplist, jumplistlink and jumplistitem

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. 我正在使用Windows API Code Pack for Microsoft .NET Framework来试用Win7任务栏的一些新的UI功能。 I am coding in C#. 我在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, eg a text document in a MRU list or run mspaint.exe. 提供的所有示例代码都假定跳转列表上的条目用于调用以运行特定应用程序或打开文档,例如MRU列表中的文本文档或运行mspaint.exe。

I would like to implement some items which allow me to set state in my own application (ie the app which is interacting with the taskbar). 我想实现一些允许我在自己的应用程序中设置状态的项目(即与任务栏交互的应用程序)。 MSN Messenger does this, for example, when you can set your status (Busy, Offline etc.). 例如,当您可以设置状态(忙,离线等)时,MSN Messenger会执行此操作。

Try as I might, I cannot create a JUmpListItem or JumpListLink to behave in this way - it treats them as applications or documents. 尽我所能,我不能创建一个JUmpListItem或JumpListLink以这种方式行事 - 它将它们视为应用程序或文档。

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. 非常感谢您的帮助。

I believe what you'd want to do is to call your application with a special set of flags (ie 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. 在应用程序启动时,您将检查是否设置了标志,然后将消息发送到应用程序的主实例,然后退出新实例。

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: 使用TaskBarDemo,打开由应用程序创建的项目必须被引用,即如果您的程序创建了PDF文件,您将执行此操作:

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. 使用API​​ Pack的跳转列表存在一些问题,我现在使用VS 2010 Beta 2并让shell处理跳转列表。

Hope this is helpfull. 希望这是有帮助的。

These tasks are some sort of IShellLink. 这些任务是某种IShellLink。 Then, you should call ICustomDestinationList's AddUserTasks. 然后,您应该调用ICustomDestinationList的AddUserTasks。 Look up samples in Windows 7 Training Kit. 在Windows 7 Training Kit中查找示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM