如何使用C#访问CLR DLL中的MFC类? [英] How do I access MFC classes in a CLR DLL using C#?

查看:88
本文介绍了如何使用C#访问CLR DLL中的MFC类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用需要访问FTP功能的C#和XAML编写应用程序。大多数(但不是全部)由FtpWebRequestMethods.Ftp类提供。缺少的是在远程服务器上执行命令的能力。



使用CFtpConnection类在MFC中可以使用此功能。



我在Visual Studio中获得创建MFC DLL或CLR(公共语言运行时)DLL的选项,但我看不出如何将两者结合起来。我相信,我需要它是CLR,因为应用程序是用C#编写的。



这可能实现吗?如果是这样,怎么样?



我的尝试:



我认为解决方案是使用CLR DLL选项,但是当我添加CFtpConnection语句并添加< afxinet.h>时,我似乎无法编译代码。 header include必需。

I am writing an application using C# and XAML that needs to access FTP functions. Most, but not all, are provided by FtpWebRequestMethods.Ftp class. What is missing is the ability to execute commands on the remote server.

This functionality is available in MFC using the CFtpConnection Class.

I get options in Visual Studio to create an MFC DLL or a CLR (Common Language Runtime) DLL, but I can't see how I can combine both. I need it to be CLR, I believe, since the application is written in C#.

Is this possible to achieve? If so, how?

What I have tried:

I think the solution is to use the CLR DLL option but I can't seem to get the code to compile when I add the CFtpConnection statement and add the <afxinet.h> header include necessary.

推荐答案

无需使用C#中的MFC。这是一个描述FtpWebRequest对象的链接。



用于FtpWebRequest的MSDN文档

[ ^ ]



此外,有很多C#FTP类,其中很多都是在CodeProject上发布的文章。



编辑============= ====================



看看这个Q / A回复。这可能会有所帮助。



在C#中使用MFC C Dll [ ^ ]
There is no need to use MFC from C#. Here's a link that describes the FtpWebRequest object.

MSDN Docs for FtpWebRequest
[^]

Furthermore, there are numerous C# FTP classes, many of which are posted as articles right here on CodeProject.

EDIT=================================

Look at this Q/A response. It might help.

use of MFC C Dll in C#[^]


这篇关于如何使用C#访问CLR DLL中的MFC类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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