|
本帖最后由 lomo1316 于 2014-1-9 15:31 编辑
调用的DLL库函数原型:
#define C_DLLEXPORT extern "C" __declspec(dllexport)
C_DLLEXPORT HANDLE Open (char* comPort);
Vc++的调用方式:
HANDLE hcom=NULL;
char comport[125]="COM1";
hcom= Open(comport);
现在的调用方式:
Local $sFileName = @ScriptDir & '\SerialComDll.dll'
Local $hDllFile = DllOpen($sFileName)
Global $gComPortArray
$stBuffer = DllStructCreate("ptr pfname;wchar fname[125]")
DllStructSetData($stBuffer, 2, "COM1")
$ptrBuffer = DllStructGetPtr($stBuffer, 2)
dllStructSetData($stBuffer, 1, $ptrBuffer)
$result = DllCall($sFileName , "ptr:cdecl", 5, "str*", DllStructGetPtr($stBuffer,2))
现在的情况是,函数返回值不对,应该是参数没正确传入,该如何调用呢?
各位大虾,Please Help Me! |
|