简体   繁体   English

如何捕获其他应用程序中的拖放

[英]How can I capture drag and drop from the other application

I searched through the answers to various questions, but I think that this one hasn't been discussed yet. 我搜索了各种问题的答案,但我认为尚未对此问题进行讨论。 There are two winforms applications one has focus and the other is running, but does not have focus. 有两个winforms应用程序,一个具有焦点,另一个正在运行,但没有焦点。

How can I capture from the not foucused one what is happening in the focused. 我如何才能从没有专心的人那里捕捉到焦点人物正在发生的事情。 In particulary I need to capture the coordinates from start and end of drag and drop. 特别是,我需要从拖放的开始和结束捕获坐标。

The app in the background has a database and I want the user to work kind of simultaneously with two apps. 后台的应用程序有一个数据库,我希望用户同时使用两个应用程序。 In one app the user does drag and drop and the other app captures coordinates and based on that searches the database and displays results. 在一个应用程序中,用户进行拖放操作,而另一应用程序则捕获坐标,并以此为基础搜索数据库并显示结果。 The user however still remains with the focus in the first one. 但是,用户仍然将焦点放在第一个。

Any help with the C# code will be much appreciated. C#代码的任何帮助将不胜感激。 Thanks, 谢谢,

You describe two separate App's, so my response assumes you have two distinct Processes (EXE's) running. 您描述了两个单独的应用程序,因此我的回答假设您有两个不同的进程(EXE)正在运行。 If that's the case, then you need to use an InterProcess Communication Mechanism, consider Named Pipes . 如果是这种情况,则需要使用进程间通信机制,请考虑使用命名管道

The Drag/Drop functions take care of that for you. 拖放功能可以帮助您解决此问题。 Just get them setup and running, it'll work between the apps automatically. 只需设置并运行它们,它就会在应用之间自动工作。 I do it all the time, forget about the other guy. 我一直在做,忘了另一个人。

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

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