开发者

How to programmatically open JumpList window for specific '.exe' file?

I know how to build JumpList for my application. But now I want to show JumpList for specific '.exe' file. I have a path to '.exe' file and I need t开发者_如何学JAVAo show JumpList for this application. JumpList window is shown when user click right mouse button over application icon on taskbar, but I need to show this window programmatically.


From the little research I did, it can be done by opening and reading the content of the files in %AppData%\Microsoft\Windows\Recent\AutomaticDestinations

The files there contain the extensions of the jump list files, by reading these files, you can find the file that contains the jump lists of the application you want by checking for repeatedly occurring file extensions. By knowing the file extensions for the applications you want to retrieve, you can thus find its jumplist file. And of course you can find applications' file extensions using the registry.

Edit: just read your post the second time: Forgive me, taught you were writing an application to replace the windows taskbar. Well, your question seems tough sorta. These steps might work:

  1. Take a screenshot of the desktop and find the part that matches the icon of the application you're looking for (which is retrievable programmatically)
  2. Subtract or match the image from your screenshot to get the location on the screen
  3. Invoke a mouse right-click at that location on the screen.

ps: The api code pack for windows 7 might also prove useful.


You might be able to use Window Messages to do it. You can use a tool like Spy++ to find out how the taskbar structures its children windows etc. Once you understand how it works, you will most probably need to SetFocus and send messages like WM_MOUSECLICK to it.

If each button isn't a real button (just a painted 'virtual' button) you will need to use some math to figure out the co-ordinates for WM_MOUSECLICK (you may need to experiment with WM_MOUSEDOWN and WM_MOUSEUP). Keep in mind that the taskbar can be anchored to different edges of the desktop, as well as be sized to 16px buttons.

If it sounds like it hack, it is, I remember Microsoft specifically saying that they wouldn't give developers this level of control with the new taskbar.

You might find PInvoke Wiki useful for getting DllImport definitions.

I have hacked the taskbar before in XP (custom start menu), so this should be possible under Windows 7.


You can use the library "Teststack.White" (simple Nuget) and then use this

var desktop = Desktop.Instance;
var taskList = desktop.Get<ToolStrip>(SearchCriteria.ByClassName("MSTaskListWClass"));
var button = taskList.Get<Button>(SearchCriteria.ByText(Text));
button.RightClick();


Jump lists are part of the secure ui you can add options to the list but showing the list itself has to be user initiated much like context menus do and mouse clicks


To be honest, I have not spent much time with JumpLists.

Did you see this example on Code Project? It's got lots of good info in it.

http://www.codeproject.com/KB/WPF/MefFX.aspx

The article is a few years old, but the information is still good.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜