c#中的LPSTR等价物 [英] LPSTR equivalent in c#
本文介绍了c#中的LPSTR等价物的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带三个参数的API
BOOL GetServerName(int index,LPSTR Buffer,int BufSize);
我如何在C#中使用此方法?
LPSTR的等价性是什么?
I have the an API that takes three parameters
BOOL GetServerName (int index, LPSTR Buffer, int BufSize);
how can i use this method in C#
what is the equivalence of LPSTR ?
推荐答案
内置支持使用MarshalAs
属性封送到LPSTR。
你调用可能是这样的;
There's built-in support for marshaling to LPSTR using theMarshalAs
attribute.
You call would likely be something like this;
bool GetServerName(int index, [MarshalAs(UnmanagedType.LPStr)] string Buffer, int BufSize)
有关封送的详细信息可以在 here [ ^ ]。
希望这会有所帮助,
Fredrik
More detailed information on marshaling can be found here[^].
Hope this helps,
Fredrik
lpstr-data-type [ ^ ]
检查链接..希望它会有所帮助..
lpstr-data-type[^]
Check the link..hope it will help..
这篇关于c#中的LPSTR等价物的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文