在进程之间移动数据 [英] moving data between processes

查看:188
本文介绍了在进程之间移动数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我问这个问题的原因是寡妇不支持在进程之间进行通信的好方法。所以我想为Windows进程之间的通信点创建一个DLL。线程由进程拥有,不能被赋予另一进程。
每个线程都有一个自己的堆栈。
如果DLL被加载(loadlibray),并且调用了一个DLL函数,它要求窗口进行内存。我写的是认为线程仍然由相同的进程拥有,并将内存分配到同一进程中。

The reason I ask this is widows do not support a good method to communicate between processes. So I want to create a DLL for a communications point between windows processes. A thread is owned by a process and cannot be given to another process. Each thread has a stack of its own. If a DLL is loaded (loadlibray) and a DLL function is called that asks windows for memory. Am I write to think the thread is still being owned by the same process and allocates memory into that same process.

所以我想我可以转到汇编来重新分配一个小的内存块到另一个进程。创建一个关键部分,将数据复制到另一个(已创建)的内存块,并使用out out设置窗口将原始块返回到其原始进程。有没有以前做过的。或者是更好的方式。

So I’m thinking can I turn to assembly to reallocate a small memory block to another process. Create a critical section, copy the data over to another (already created) memory block and return to the original block to its original process with out up setting windows. Has any one done that before. Or is thier a better way.

最好的问候,
Lex Dean。

Best regards, Lex Dean.

我看到其他方法,螨相当快,但我想要一个非常快的方法,有一点头。管道和互联网显然会起作用,但并不是最好的选择,但实施起来很简单(感谢提供这样的建议)。有时我想以相当规律的间隔发送不少于500字节的块。我喜欢WM_COPYDATA,因为它看起来很快,我一直在互联网上看到的最大的问题是: - GetCurrentProcess和DuplicateHandle来获取真正的句柄。寻找另一个过程。并使用消息设置内存,然后使用WM_COPYDATA。我只需要两个消息a)指针和大小b)数据已被复制。
我得到我的应用程序流程容易'GetCurrentProcess',除了它是一个伪句柄,这总是$ FFFFFFE。我需要真正的处理句柄,互联网上没有任何一个body可以给出一个DuplicateHandle的例子。这就是我的痛苦。你能给我一个DuplicateHandle的例子,因为这是我陷入困境?

I see other methods that mite be quite fast but I would like a very fast method that has little over head. Pipes and internet will obviously work but are not the best option yet simple to implement (thanks to offer such suggestions guys). I want to send quite a few 500 byte blocks at quite regular intervals sometimes. I like WM_COPYDATA because it looks fast, my biggest question that I have been looking all over the internet is:- GetCurrentProcess and DuplicateHandle to get the real handle. Finding the other process. And using messages to set up memory and then use WM_COPYDATA. I only need two messages a) the pointer and size b) the data has been copied. I get my application process easy ‘GetCurrentProcess’ except it’s a pseudo handle, that’s always $FFFFFFE. I need the real process handle and no body on the internet gives an example of DuplicateHandle. That’s what’s got me stumped. Can you show me an example of DuplicateHandle as that’s what’s got me stumped?

我不喜欢转换为一个表单来获取句柄,因为一个应用程序并不总是具有当前的形式。
我不喜欢转换为一个表单来获取句柄,因为一个应用程序并不总是具有当前的形式。
在Delphi中,我看到使用TSpeedButton发送消息,在应用程序之间设置一个简单的快速通信方法,最可能使用大约80条指令。所以我还在想dll的想法。 Mads Elvheim发送的示例与我已经知道的一样。
我仍​​然愿意了解使用我自己的任何其他选项* .Dll
由于我的应用程序对我很重要,可以简单地在* .DLL上注册/注销自己的进程,而不是一直在搜索看看一个进程是否是最新的。
这是我如何用进程之间的* .DLL管理内存,但是我没有被告知。
对我来说,DLL不是很难实现,因为我已经有一个我自己的操作。

I do not like turning to a form to get a handle as one application dose not always have a current form. I do not like turning to a form to get a handle as one application dose not always have a current form. In Delphi I have seen message sending with TSpeedButton to set up a simple fast communication methods between applications that most probably uses about 80 instructions I guess. And so I still thinking to think dll’s. The example Mads Elvheim sent is on that same line as what I already know. I'm still willing to understand any other options of using my own *.Dll Because my applications important to me can simply register/unregister on the *.DLL its own process rather than searching all the time to see if a process is current. It’s how I manage memory with a *.DLL between process but I’m not told about. To me DLL’s are not hard to implement to me as I already have one of my own in operation.

真正的底线是访问Windows以创建一个好的选项。因为我很开心的想法。即使进程之间的汇编指令或Windows调用。但是我不会通过做非法的事来让法庭破坏窗户。
所以请举一个例子,说明你所做的是对我的需求。这很快,我有兴趣,因为我最有可能会使用它。

The real bottom line is access to windows to create a good option. As I’m very open to idea’s. Even the assembly instructions for between processes or a windows call. But I do not what to get court crashing windows ether by doing things illegal. So please show an example of what you have done that is to my needs. That is fast and I’m interested as I most probably will use it anyway.

推荐答案

我有一个基于命名管道的非常快速的IPC(进程间通信)解决方案。它非常快速,非常易于使用(它隐藏了您的实际实现,您只需使用数据包)。也经过测试和验证。你可以在这里找到代码和演示。

I have a very fast IPC (interprocess communication) solution based on named pipes. It is very fast and very easy to use (It hides the actual implementation from you. You just work with data packets). Also tested and proven. You can find the code and the demo here.

http://www.cromis.net/blog/downloads/cromis-ipc/

它也可以在相同的局域网。

It also works across computers in the same LAN.

这篇关于在进程之间移动数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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