如何在c#中声明mfc API [英] How to declare mfc API in c#

查看:117
本文介绍了如何在c#中声明mfc API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用MFC dll编写的API。

我想在我的c#应用程序中使用它。



请帮助我在c中声明API#



这是API

BOOL __stdcall SearchMAC(LPCTSTR strIP,CString&strMac)



我需要读取电子板的MAC地址

I have a API which is written in MFC dll.
I want to use it in my c# application.

Kindly help me to declare the API in c#

This is the API
BOOL __stdcall SearchMAC(LPCTSTR strIP,CString &strMac)

I need to read the MAC address of Electronic board

推荐答案

参见 P / Invoke教程 [ ^ ]。


您需要通过DLLImport属性使用Platform Invoke 。

见这里 http:// msdn。 microsoft.com/en-us/library/aa288468(v=vs.71).aspx [ ^ ]的概述,这里: http://msdn.microsoft.com/en-us/library/ac7ay120(ⅴ = vs.110).aspx [ ^ ]获取数据类型转换列表。
You need to use Platform Invoke via the DLLImport attribute.
See here http://msdn.microsoft.com/en-us/library/aa288468(v=vs.71).aspx[^] for an overview, and here: http://msdn.microsoft.com/en-us/library/ac7ay120(v=vs.110).aspx[^] for a list of datatype conversions.


这篇关于如何在c#中声明mfc API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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