C#拖放到应用程序任务栏图标 [英] C# Drag and drop to application taskbar icon

查看:108
本文介绍了C#拖放到应用程序任务栏图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将(文件,文本)拖放到WindowsForms应用程序(C#)的任务栏图标上?

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

我知道没有简单的方法托盘图标(它涉及使用Win32 API和挂钩),但是我想知道任务栏是否可行。

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.

推荐答案

至少在Windows 7中可能是 。请注意,这两个较早的答案所涉及的博客文章来自2004年。在Windows 7和以前的版本中,可以将文件拖放到应用程序上如果您在放下时按住shift键,则在任务栏上。支持此功能的应用程序示例包括Firefox,Internet Explorer,记事本等。

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.

为了支持此功能,您的exe文件必须能够支持命令行 myapp.exe<某些文件路径> ,我相信您需要与这样的答案

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.

更新:

我将此添加到了我的一个应用程序中,并且可以使用。您不需要注册表项。

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

这篇关于C#拖放到应用程序任务栏图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆