VC ++ 6 MFC迁移托管C ++(windows窗体) [英] VC++6 MFC migration managed C++(windows form )

查看:74
本文介绍了VC ++ 6 MFC迁移托管C ++(windows窗体)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想移植我的MFC(VC ++ 6)应用程序来管理VC ++。 7.我想这样做,因为有些事情比C#好得多。所以我可以编写一个C#

类并使用

我的VC ++代码作为语言互操作性是

的主要功能之一.Net

框架。我知道我的应用程序必须服从CTS(普通类型

规范),但我主要担心的是MFC的东西!

我真的不知道你有哪些选项与窗体形式。他们可以做什么?
MFC

可以做什么?函数指针怎么样?托管C ++如何解决这个问题?

也许这不是发布此内容的正确位置,但是任何有用的评论都将

非常好

赞赏。


谢谢

解决方案

" Bredal Jensen" <峰; br *********** @ mimosa.com>写在

新闻:e4 ************** @ TK2MSFTNGP15.phx.gbl ...



我想移植我的MFC(VC ++ 6)应用程序来管理VC ++。 7.我想
这样做是因为使用C#可以做得更好。所以我可以写一个
C#
类并在我的VC ++代码中使用,因为语言互操作性是.Net
框架的主要特性之一。


第一个端口到非托管VC ++ 7. MFC 6和MFC 7确实有一些区别。

之后,将代码编译为托管代码通常只是编译器

开关。

我知道我的应用程序必须遵守CTS(通用类型
规范),但我主要担心的是MFC的东西!


你仍然可以在托管C ++中做任何事情;你只需要遵守CTS规则

你想要暴露给其他语言的类型(比如C#)

我真的不知道你对windows窗体有哪些选择。他们可以做MFC可以做什么吗?


IMO将你的MFC应用程序转换为WinForms是一个好主意,但是

没有必要这样做。

函数指针怎么样?托管C ++如何处理这个问题?




这是管理的,但它仍然是C ++。你有const类型,模板,函数

指针,无效指针...

如果你不能将你的C ++代码编译为托管代码,你仍然可以使用COM

互操作。


希望这会有所帮助,


Niki


非常感谢您的回答,我已经使用Vc ++编译.7。

那么这个编译器开关我必须添加什么?




" Niki Estner" < NI ********* @ cube.net>在消息中写道

news:%2 **************** @ TK2MSFTNGP09.phx.gbl ...

" Bredal Jensen <峰; br *********** @ mimosa.com>在
新闻中写道:e4 ************** @ TK2MSFTNGP15.phx.gbl ...



我想要移植我的MFC(VC ++ 6)应用程序来管理VC ++。 7.我想
这样做是因为使用C#可以做得更好。所以我可以编写
a C#
类并在我的VC ++代码中使用,因为语言互操作性是.Net
框架的主要功能之一。
首先将它移植到非托管VC ++ 7. MFC 6和MFC 7确实有一些



差异。之后,将代码编译为托管代码通常只是编译器切换。

我知道我的应用程序必须服从CTS(普通类型
规范)但我主要担心的是MFC的东西!
你仍然可以在托管C ++中做任何事情;你只需要遵守CTS规则
你想要暴露给其他语言的类型(比如C#)

我真的不知道你对windows窗体有哪些选择。他们可以做MFC可以做什么吗?



IMO将你的MFC应用程序转换为WinForms是一个好主意,但是
那里'没有必要这样做。

函数指针怎么样。托管C ++如何解决这个问题?



它已经被管理,但它仍然是C ++。你有const类型,模板,



函数指针,void指针......

如果你不能将你的C ++代码编译为托管代码,那么你仍然可以使用
COM互操作。

希望这会有所帮助,

Niki


" Bredal Jensen" <峰; br *********** @ mimosa.com>写在

新闻:ew ************** @ tk2msftngp13.phx.gbl ...

谢谢你的回答,我已经用Vc ++编译了.7。

那么这个编译器开关我必须添加什么?




转到你的属性project - general tab - switch" use managed

extensions"到是。

您可能必须解决与其他项目设置的一些冲突,但是之后您应该能够将托管代码包含到您的应用程序中。


Niki



I want to port my MFC (VC++6) application to manageg VC ++. 7. I want to do
this because some things are much better done with C#. So i could write a C#
class and use in
my VC++ code as Languague interoperability is one of the main features of
the .Net
framework. I know my application would have to obey to the CTS (common type
specification) but my main concerns are the MFC stuff!
I do not really know which options you have with windows forms. Can they do
what MFC
can do? How about functions pointers. How does managed C++ deal with this?
Maybe this is not the right place to post this, but any usefull comment will
be very
appreciated.

Thanks

解决方案

"Bredal Jensen" <Br***********@mimosa.com> wrote in
news:e4**************@TK2MSFTNGP15.phx.gbl...


I want to port my MFC (VC++6) application to manageg VC ++. 7. I want to
do
this because some things are much better done with C#. So i could write a
C#
class and use in
my VC++ code as Languague interoperability is one of the main features of
the .Net
framework.
First port it to unmanaged VC++ 7. MFC 6 and MFC 7 do have some differences.
After that, compiling the code as managed code is usually only a compiler
switch.
I know my application would have to obey to the CTS (common type
specification) but my main concerns are the MFC stuff!
You can still do anything in managed C++; You only have to obey CTS rules
for the types you want to expose to other languages (like C#)
I do not really know which options you have with windows forms. Can they
do
what MFC can do?
IMO it would be a good idea to convert your MFC app to WinForms, however
there''s no real need to do that.
How about functions pointers. How does managed C++ deal with this?



It''s managed, but it''s still C++. You have const types, templates, function
pointers, void pointers...

If you can''t compile your C++ code as managed code, you could still use COM
interop.

Hope this helps,

Niki


Well thanks for your answer, i have already compiled with Vc++.7 .
So what is this compiler switch i have to add?



"Niki Estner" <ni*********@cube.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...

"Bredal Jensen" <Br***********@mimosa.com> wrote in
news:e4**************@TK2MSFTNGP15.phx.gbl...


I want to port my MFC (VC++6) application to manageg VC ++. 7. I want to
do
this because some things are much better done with C#. So i could write a C#
class and use in
my VC++ code as Languague interoperability is one of the main features of the .Net
framework.
First port it to unmanaged VC++ 7. MFC 6 and MFC 7 do have some


differences. After that, compiling the code as managed code is usually only a compiler
switch.

I know my application would have to obey to the CTS (common type
specification) but my main concerns are the MFC stuff!
You can still do anything in managed C++; You only have to obey CTS rules
for the types you want to expose to other languages (like C#)

I do not really know which options you have with windows forms. Can they
do
what MFC can do?



IMO it would be a good idea to convert your MFC app to WinForms, however
there''s no real need to do that.

How about functions pointers. How does managed C++ deal with this?



It''s managed, but it''s still C++. You have const types, templates,


function pointers, void pointers...

If you can''t compile your C++ code as managed code, you could still use COM interop.

Hope this helps,

Niki



"Bredal Jensen" <Br***********@mimosa.com> wrote in
news:ew**************@tk2msftngp13.phx.gbl...

Well thanks for your answer, i have already compiled with Vc++.7 .
So what is this compiler switch i have to add?



Go to the properties of your project - general tab - switch "use managed
extensions" to "yes".
You may have to resolve a few conflicts with other project settings, but
afterwards you should be able to include managed code into your application.

Niki


这篇关于VC ++ 6 MFC迁移托管C ++(windows窗体)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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