[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());
uj5u.com熱心網友回復:
這個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;
uj5u.com熱心網友回復:
呼叫了mmtools.dll中的WxSetDeviceInfo。樓上
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/66156.html
上一篇:delphi 10 移動開發如何保存密碼和讀取保存的密碼?
下一篇:散分,不記得多久沒來過了,發布一個自己寫的軟體,H264/AAC錄制視音頻,保存FLV,支持RTMP直播,delphi寫的主程式,這么多年了還是喜歡delphi
