C# Drag and drop to application taskbar icon

狂风中的少年 提交于 2020-01-15 23:37:48

问题


Is it possible to drag and drop (files, text) to the taskbar icon of a WindowsForms application (C#)?

I know there's no easy way to do it for the tray icon (it involves using Win32 API and hooks), but I was wondering if it's possible for the taskbar.


回答1:


That's not possible, but the window manager automatically restores the minimized window if you hover over it long enough in the taskbar. Once restored, you can access all the drop targets your window implements.




回答2:


It is possible, at least in Windows 7. Note that the blog post which the two older answers refer to is from 2004. In Windows 7 and possibly previous versions, it is possible to drop files onto applications on the taskbar if you hold shift while dropping. Examples of applications that support this are Firefox, Internet Explorer, Notepad, etc.

In order to support it, your exe needs to be able to support the command line myapp.exe <some file path> and I believe you need registry entries similar to those described in this SO answer.

Update:

I added this to one of my applications, and it works. You do not need the registry entries.




回答3:


This is fundamentally impossible.



来源:https://stackoverflow.com/questions/3926464/c-sharp-drag-and-drop-to-application-taskbar-icon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!