有visualc ++代码但需要C#代码用于brics cad应用程序 [英] Having visualc++ code but need C# code for brics cad application

查看:56
本文介绍了有visualc ++代码但需要C#代码用于brics cad应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家早上好..



我正在使用c#4.0和Brics cad ..在bricscad中生成图纸。我得到了..但是我的问题是..只用c#窗口形式显示图形而不打开brics cad ..

- >我在visual c ++中得到了这个选项,但我''我不理解那个代码..

- >任何人请帮我解决这个问题用c#编码





thankyou

推荐答案

没有奇迹这样的东西:如果你需要使用一些C ++代码,你需要学习一些C ++,足以理解它,或者有人去做这部分工作。



您可以重复使用C ++代码并将其绑定到您的.NET应用程序,但请不要认为您可以在不理解的情况下执行此操作。也许它需要比大多数纯C ++开发人员更深入地理解C ++,因为他们中的许多人都不了解很多内部,但是所有的互操作问题都要求你理解它们。



您需要这些知识才能使用P / Invoke。



如果您需要学习P / Invoke,请从这里开始:

http://en.wikipedia.org/wiki/P/Invoke [ ^ ],

http://msdn.microsoft.com/en-us/library/Aa712982 [ ^ ]。



此CodeProject可以也很有用: Essential P / Invoke [ ^ ]。



解决方案的硬度取决于C ++接口的复杂程度。它可以从非常容易到最棘手。



P / Invoke的一种替代方法是使用C ++ / CLI混合模式(托管+非托管)项目。此项目可以构建全局钩子所需的DLL,但它可以包含一些托管包装器CLI代码,因此,从.NET应用程序的角度来看,您可以将其用作常规.NET程序集,即引用它。请参阅:

http://en.wikipedia.org/wiki/C %2B%2B / CLI [ ^ ],

http://www.ecma-international .org / publications / standards / Ecma-372.htm [ ^ ],

http:/ /msdn.microsoft.com/en-us/library/xey702bw.aspx [ ^ ],

http:/ /msdn.microsoft.com/en-us/library/3bstk3k5 [ ^ ]。



但请注意这样就需要你学习C ++和C ++ / CLI,这是另一种语言。准备做一些工作? :-)



-SA
There are no such thing as a miracle: if you need some C++ code to be used, you will need to learn some C++, enough to understand it, or have someone to do this part of work.

You can re-use C++ code and bind it to your .NET application, but please don''t think that you can do it without understanding. Maybe it will require deeper understanding of C++ than most of pure-C++ developers have, because many of them don''t understand many internals, but all interop problems requires you to understand them.

You will need this knowledge to use P/Invoke.

If you need to learn P/Invoke, start from here:
http://en.wikipedia.org/wiki/P/Invoke[^],
http://msdn.microsoft.com/en-us/library/Aa712982[^].

This CodeProject can also be useful: Essential P/Invoke[^].

The hardness of solution will depend on complexity of C++ interfaces. It can range from very easy to most tricky.

One alternative to P/Invoke is to use C++/CLI mixed-mode (managed+unmanaged) project. This project could build a DLL required by the global hooks, but it can contain some managed wrapper CLI code, so, from the standpoint of your .NET application, you can use it as a regular .NET assembly, that is, reference it. Please see:
http://en.wikipedia.org/wiki/C%2B%2B/CLI[^],
http://www.ecma-international.org/publications/standards/Ecma-372.htm[^],
http://msdn.microsoft.com/en-us/library/xey702bw.aspx[^],
http://msdn.microsoft.com/en-us/library/3bstk3k5[^].

But note that this way will require you to learn both C++ and C++/CLI, yet another language. Ready to do some work? :-)

—SA


这篇关于有visualc ++代码但需要C#代码用于brics cad应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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