将SWT Composite嵌入到C#应用程序中 [英] Embed SWT Composite into C# application

查看:206
本文介绍了将SWT Composite嵌入到C#应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用SWT作为其widget工具包的Java应用程序。

I've got a Java application that uses SWT as its widget toolkit.

我还有一个Windows C#应用程序。

I've also got a Windows C# application.

我想要一种方法将SWT Composite绘制到这个C#应用程序中。

I'd like a way to draw an SWT Composite into this C# application.

我可以想到两种方法:


  • 句柄:由于SWT基于本机窗口工具包,似乎应该有一个在C#应用程序中创建Composite的方法,将本机指针传递给Java应用程序,然后从那里控制Composite。

  • Handles: Since SWT is based on the native windowing toolkit, it seems like there should be a way to create a Composite in the C# application, pass the native pointer to the Java application, and then control the Composite from there.

OLE: 由于SWT肯定可以使用OLE组件,也许它还有一种方法可以将自己呈现为OLE组件?

OLE: Since SWT can definitely consume OLE components, maybe there's also a way for it to present itself as an OLE component?

任何人都有关于如何实现这一目标的任何提示?我并不害怕Java和C#在启动时之间的复杂通信,但我真的希望能够在设置后无缝地从Java控制Composite。

Anybody have any tips on how I can accomplish this? I'm not afraid of complicated communication between the Java and C# on startup, but I'm really hoping to be able to control the Composite from Java seamlessly once it is set up.

推荐答案

要将SWT组合放入winform中,可以在新进程中启动SWT应用程序,然后使用Process.MainWindowHandle获取子进程窗口句柄。

To put your SWT composite inside your winform you can start the SWT application in new process and then use Process.MainWindowHandle to get the child process window handle.

文章提供了合并另一个流程的示例。

This article provide an example to composite another process.

这个链接是winform内部的SWT和winform内的winform的特定解决方案(更改流程开始......)。

This link is a specific solution for SWT inside winform and winform inside winform(change the process to start...).

在解决方案中,我还展示了一种通过std-in / out在流程之间进行通信的方法。(有很多关于它的问题)

In the solution I also demonstrate a way to communicate between the processes through the std-in/out.(there are a lot of questions about it)

提示:
存储库中的代码不是生产代码! (C#和Java)

Hint: The code in the repository is not a production code! (C# and Java)

我只是想提供一个演示。当我有时间时,我会重构代码......

I just want to provide a demo. when i have time, i will refactor the code...

这篇关于将SWT Composite嵌入到C#应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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