求把一段C#代码,翻译成Delphi

Alex-16888 2016-07-09 01:36:58
[DllImport("mmtools.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void WxSetDeviceInfo(int pWorker, tagDeviceInfo[] pDeviceInfo);


public struct tagDeviceInfo
{
public string ostype;
public string devicebrand;




List<tagDeviceInfo> list = new List<tagDeviceInfo>();
tagDeviceInfo dev = new tagDeviceInfo();

list.Add(dev);
WxSetDeviceInfo(worker, list.ToArray());
...全文
1166 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
骑牛上铂金 2016-07-15
  • 打赏
  • 举报
回复
调用了mmtools.dll中的WxSetDeviceInfo。 楼上
  • 打赏
  • 举报
回复
这个mmtools本身是用Delphi写的,从 CallingConvention = CallingConvention.Cdecl 这个声明来看,mmtools.dll应该是对Delphi版本做了二次封装,又用C#调用,真够绕的,所以你最好直接找Delphi版本源码,应该有demo可以参考。 就这个声明来说,大致如此吧: type tagDeviceInfo = record ostype: string; devicebrand: string; end; procedure WxSetDeviceInfo(pWorker: integer; pDeviceInfo: array of tagDeviceInfo); cdecl. external 'mmtools.dll'; procedure test; var worker: integer; dev: array of tagDeviceInfo; begin worker := 0; // 是否要赋初值可以试试 SetLength(dev, 1); WxSetDeviceInfo(worker, dev); end;

1,184

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧