问题
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