#pragma once
#pragma pack(push, 1)
typedef struct tagSPPNR
{
char etax[3][10];
char ecur[10];
char equiv[12];
char number[15];
char airline[10];
char calc[50];
char remark[24][100];
int infseq;
int segcount;
int type;
} SPPNR, * SPPPNR;
#pragma pack(pop)
这样怎么获得?
如果返回是个数组怎么获得?
14 个解决方案
#1
有人吗
#2
#3
用DynamicWrapper方法调用。下载DynamicWrapper.dll到php ext下与windows system32下,
$dw = new COM("DynamicWrapper");
$dw->Register("EbUsbApi.dll", "EbCreateDataFile", 'i=sls', "f=s", "r=l");
$ch = $dw->EbCreateDataFile("222",11,"22");
dll其中一个函数
HANDLE EbCreateDataFile(LPCTSTR lpFileName, DWORD dwCreationDisposition, LPCTSTR lpPassword)
得到结果0.成功
$dw = new COM("DynamicWrapper");
$dw->Register("EbUsbApi.dll", "EbCreateDataFile", 'i=sls', "f=s", "r=l");
$ch = $dw->EbCreateDataFile("222",11,"22");
dll其中一个函数
HANDLE EbCreateDataFile(LPCTSTR lpFileName, DWORD dwCreationDisposition, LPCTSTR lpPassword)
得到结果0.成功
#4
#5
3楼的方法应该可行,具体没测试过
#6
顶3#
楼主这个C+代码不就是PHP的二进制库函数PACH吗??
楼主这个C+代码不就是PHP的二进制库函数PACH吗??
#7
是不是ActiveX。如果是,使用COM来建立接口。
#8
extern "C" DWORD PASCAL EXPORT SP_GetAnalyzePnrInstance(IN char * szPnrData, IN DWORD dwPnrLength)
DLL中有这个方法,我PHP如何去调用呢
$dw->Register("EbUsbApi.dll", "EbCreateDataFile", 'i=sls', "f=s", "r=l");
里面的 'i=sls', "f=s", "r=l" 是传入参数和返回参数的定义吧,那我
extern "C" DWORD PASCAL EXPORT SP_GetAnalyzePnrInstance(IN char * szPnrData, IN DWORD dwPnrLength)
应该怎么设置呢
#9
i=describes the number and data type of the functions parameters
f=type of call _stdcall or _cdecl. So it can work with both MS C++ and Borland C++. Default to _stdcall. If that doesn't work use _cdecl. If that doesn't work good luck!
r=return data type.
Data types are:
const ARGTYPEINFO ArgInfo[] =
{
{'a', sizeof(IDispatch*), VT_DISPATCH}, // a IDispatch*
{'c', sizeof(unsigned char), VT_I4}, // c signed char
{'d', sizeof(double), VT_R8}, // d 8 byte real
{'f', sizeof(float), VT_R4}, // f 4 byte real
{'k', sizeof(IUnknown*), VT_UNKNOWN}, // k IUnknown*
{'h', sizeof(long), VT_I4}, // h HANDLE
{'l', sizeof(long), VT_I4}, // l long
{'p', sizeof(void*), VT_PTR}, // p pointer
{'s', sizeof(BSTR), VT_LPSTR}, // s string
{'t', sizeof(short), VT_I2}, // t short
{'u', sizeof(UINT), VT_UINT}, // u unsigned int
{'w', sizeof(BSTR), VT_LPWSTR}, // w wide string
}
IN char * 应该选择什么?
IN DWORD 应该选择什么?
PHP如何转换过去呢
f=type of call _stdcall or _cdecl. So it can work with both MS C++ and Borland C++. Default to _stdcall. If that doesn't work use _cdecl. If that doesn't work good luck!
r=return data type.
Data types are:
const ARGTYPEINFO ArgInfo[] =
{
{'a', sizeof(IDispatch*), VT_DISPATCH}, // a IDispatch*
{'c', sizeof(unsigned char), VT_I4}, // c signed char
{'d', sizeof(double), VT_R8}, // d 8 byte real
{'f', sizeof(float), VT_R4}, // f 4 byte real
{'k', sizeof(IUnknown*), VT_UNKNOWN}, // k IUnknown*
{'h', sizeof(long), VT_I4}, // h HANDLE
{'l', sizeof(long), VT_I4}, // l long
{'p', sizeof(void*), VT_PTR}, // p pointer
{'s', sizeof(BSTR), VT_LPSTR}, // s string
{'t', sizeof(short), VT_I2}, // t short
{'u', sizeof(UINT), VT_UINT}, // u unsigned int
{'w', sizeof(BSTR), VT_LPWSTR}, // w wide string
}
IN char * 应该选择什么?
IN DWORD 应该选择什么?
PHP如何转换过去呢
#10
因为我是PHP5.3 我使用的方法是
用DynamicWrapper方法调用。下载DynamicWrapper.dll到php ext下与windows system32下,
$dw = new COM("DynamicWrapper");
DLL中有个方法
extern "C" DWORD PASCAL EXPORT SP_GetAnalyzePnrInstance(IN char * szPnrData, IN DWORD dwPnrLength)
$dw->Register("EbUsbApi.dll", "SP_GetAnalyzePnrInstance", 'i=cl', "f=s", "r=l");
$ch = $dw->SP_GetAnalyzePnrInstance("test",4);
但是这里报参数错误,我应该怎么传入参数?
用DynamicWrapper方法调用。下载DynamicWrapper.dll到php ext下与windows system32下,
$dw = new COM("DynamicWrapper");
DLL中有个方法
extern "C" DWORD PASCAL EXPORT SP_GetAnalyzePnrInstance(IN char * szPnrData, IN DWORD dwPnrLength)
$dw->Register("EbUsbApi.dll", "SP_GetAnalyzePnrInstance", 'i=cl', "f=s", "r=l");
$ch = $dw->SP_GetAnalyzePnrInstance("test",4);
但是这里报参数错误,我应该怎么传入参数?
#11
Unknown: Could not convert string to unicode: `在多字节的目标代码页中,没有此 Unicode 字符可以映射到的字符。 这个问题这么解决?
报这个错误。。。 这里有没有人啊~~~~~~~~·
报这个错误。。。 这里有没有人啊~~~~~~~~·
#12
没有使用过 DynamicWrapper
不过根据错误信息,可认为你传递的字符串不是 ucs-2 编码
#13
那请问我有个
extern "C" LPVOID PASCAL EXPORT SP_GetNextPnr(IN DWORD dwInstance, IN OUT DWORD * pdwPosition)
IN OUT DWORD * pdwPosition,这个参数我PHP应该传什么进去? 因为这个参数是传入返回的,返回出来的应该是个内存地址
#14
Data types are:
const ARGTYPEINFO ArgInfo[] =
{
{'a', sizeof(IDispatch*), VT_DISPATCH}, // a IDispatch*
{'c', sizeof(unsigned char), VT_I4}, // c signed char
{'d', sizeof(double), VT_R8}, // d 8 byte real
{'f', sizeof(float), VT_R4}, // f 4 byte real
{'k', sizeof(IUnknown*), VT_UNKNOWN}, // k IUnknown*
{'h', sizeof(long), VT_I4}, // h HANDLE
{'l', sizeof(long), VT_I4}, // l long
{'p', sizeof(void*), VT_PTR}, // p pointer
{'s', sizeof(BSTR), VT_LPSTR}, // s string
{'t', sizeof(short), VT_I2}, // t short
{'u', sizeof(UINT), VT_UINT}, // u unsigned int
{'w', sizeof(BSTR), VT_LPWSTR}, // w wide string
}
返回值为布尔类型应该选哪个?
const ARGTYPEINFO ArgInfo[] =
{
{'a', sizeof(IDispatch*), VT_DISPATCH}, // a IDispatch*
{'c', sizeof(unsigned char), VT_I4}, // c signed char
{'d', sizeof(double), VT_R8}, // d 8 byte real
{'f', sizeof(float), VT_R4}, // f 4 byte real
{'k', sizeof(IUnknown*), VT_UNKNOWN}, // k IUnknown*
{'h', sizeof(long), VT_I4}, // h HANDLE
{'l', sizeof(long), VT_I4}, // l long
{'p', sizeof(void*), VT_PTR}, // p pointer
{'s', sizeof(BSTR), VT_LPSTR}, // s string
{'t', sizeof(short), VT_I2}, // t short
{'u', sizeof(UINT), VT_UINT}, // u unsigned int
{'w', sizeof(BSTR), VT_LPWSTR}, // w wide string
}
返回值为布尔类型应该选哪个?
#1
有人吗
#2
#3
用DynamicWrapper方法调用。下载DynamicWrapper.dll到php ext下与windows system32下,
$dw = new COM("DynamicWrapper");
$dw->Register("EbUsbApi.dll", "EbCreateDataFile", 'i=sls', "f=s", "r=l");
$ch = $dw->EbCreateDataFile("222",11,"22");
dll其中一个函数
HANDLE EbCreateDataFile(LPCTSTR lpFileName, DWORD dwCreationDisposition, LPCTSTR lpPassword)
得到结果0.成功
$dw = new COM("DynamicWrapper");
$dw->Register("EbUsbApi.dll", "EbCreateDataFile", 'i=sls', "f=s", "r=l");
$ch = $dw->EbCreateDataFile("222",11,"22");
dll其中一个函数
HANDLE EbCreateDataFile(LPCTSTR lpFileName, DWORD dwCreationDisposition, LPCTSTR lpPassword)
得到结果0.成功
#4
#5
3楼的方法应该可行,具体没测试过
#6
顶3#
楼主这个C+代码不就是PHP的二进制库函数PACH吗??
楼主这个C+代码不就是PHP的二进制库函数PACH吗??
#7
是不是ActiveX。如果是,使用COM来建立接口。
#8
extern "C" DWORD PASCAL EXPORT SP_GetAnalyzePnrInstance(IN char * szPnrData, IN DWORD dwPnrLength)
DLL中有这个方法,我PHP如何去调用呢
$dw->Register("EbUsbApi.dll", "EbCreateDataFile", 'i=sls', "f=s", "r=l");
里面的 'i=sls', "f=s", "r=l" 是传入参数和返回参数的定义吧,那我
extern "C" DWORD PASCAL EXPORT SP_GetAnalyzePnrInstance(IN char * szPnrData, IN DWORD dwPnrLength)
应该怎么设置呢
#9
i=describes the number and data type of the functions parameters
f=type of call _stdcall or _cdecl. So it can work with both MS C++ and Borland C++. Default to _stdcall. If that doesn't work use _cdecl. If that doesn't work good luck!
r=return data type.
Data types are:
const ARGTYPEINFO ArgInfo[] =
{
{'a', sizeof(IDispatch*), VT_DISPATCH}, // a IDispatch*
{'c', sizeof(unsigned char), VT_I4}, // c signed char
{'d', sizeof(double), VT_R8}, // d 8 byte real
{'f', sizeof(float), VT_R4}, // f 4 byte real
{'k', sizeof(IUnknown*), VT_UNKNOWN}, // k IUnknown*
{'h', sizeof(long), VT_I4}, // h HANDLE
{'l', sizeof(long), VT_I4}, // l long
{'p', sizeof(void*), VT_PTR}, // p pointer
{'s', sizeof(BSTR), VT_LPSTR}, // s string
{'t', sizeof(short), VT_I2}, // t short
{'u', sizeof(UINT), VT_UINT}, // u unsigned int
{'w', sizeof(BSTR), VT_LPWSTR}, // w wide string
}
IN char * 应该选择什么?
IN DWORD 应该选择什么?
PHP如何转换过去呢
f=type of call _stdcall or _cdecl. So it can work with both MS C++ and Borland C++. Default to _stdcall. If that doesn't work use _cdecl. If that doesn't work good luck!
r=return data type.
Data types are:
const ARGTYPEINFO ArgInfo[] =
{
{'a', sizeof(IDispatch*), VT_DISPATCH}, // a IDispatch*
{'c', sizeof(unsigned char), VT_I4}, // c signed char
{'d', sizeof(double), VT_R8}, // d 8 byte real
{'f', sizeof(float), VT_R4}, // f 4 byte real
{'k', sizeof(IUnknown*), VT_UNKNOWN}, // k IUnknown*
{'h', sizeof(long), VT_I4}, // h HANDLE
{'l', sizeof(long), VT_I4}, // l long
{'p', sizeof(void*), VT_PTR}, // p pointer
{'s', sizeof(BSTR), VT_LPSTR}, // s string
{'t', sizeof(short), VT_I2}, // t short
{'u', sizeof(UINT), VT_UINT}, // u unsigned int
{'w', sizeof(BSTR), VT_LPWSTR}, // w wide string
}
IN char * 应该选择什么?
IN DWORD 应该选择什么?
PHP如何转换过去呢
#10
因为我是PHP5.3 我使用的方法是
用DynamicWrapper方法调用。下载DynamicWrapper.dll到php ext下与windows system32下,
$dw = new COM("DynamicWrapper");
DLL中有个方法
extern "C" DWORD PASCAL EXPORT SP_GetAnalyzePnrInstance(IN char * szPnrData, IN DWORD dwPnrLength)
$dw->Register("EbUsbApi.dll", "SP_GetAnalyzePnrInstance", 'i=cl', "f=s", "r=l");
$ch = $dw->SP_GetAnalyzePnrInstance("test",4);
但是这里报参数错误,我应该怎么传入参数?
用DynamicWrapper方法调用。下载DynamicWrapper.dll到php ext下与windows system32下,
$dw = new COM("DynamicWrapper");
DLL中有个方法
extern "C" DWORD PASCAL EXPORT SP_GetAnalyzePnrInstance(IN char * szPnrData, IN DWORD dwPnrLength)
$dw->Register("EbUsbApi.dll", "SP_GetAnalyzePnrInstance", 'i=cl', "f=s", "r=l");
$ch = $dw->SP_GetAnalyzePnrInstance("test",4);
但是这里报参数错误,我应该怎么传入参数?
#11
Unknown: Could not convert string to unicode: `在多字节的目标代码页中,没有此 Unicode 字符可以映射到的字符。 这个问题这么解决?
报这个错误。。。 这里有没有人啊~~~~~~~~·
报这个错误。。。 这里有没有人啊~~~~~~~~·
#12
没有使用过 DynamicWrapper
不过根据错误信息,可认为你传递的字符串不是 ucs-2 编码
#13
那请问我有个
extern "C" LPVOID PASCAL EXPORT SP_GetNextPnr(IN DWORD dwInstance, IN OUT DWORD * pdwPosition)
IN OUT DWORD * pdwPosition,这个参数我PHP应该传什么进去? 因为这个参数是传入返回的,返回出来的应该是个内存地址
#14
Data types are:
const ARGTYPEINFO ArgInfo[] =
{
{'a', sizeof(IDispatch*), VT_DISPATCH}, // a IDispatch*
{'c', sizeof(unsigned char), VT_I4}, // c signed char
{'d', sizeof(double), VT_R8}, // d 8 byte real
{'f', sizeof(float), VT_R4}, // f 4 byte real
{'k', sizeof(IUnknown*), VT_UNKNOWN}, // k IUnknown*
{'h', sizeof(long), VT_I4}, // h HANDLE
{'l', sizeof(long), VT_I4}, // l long
{'p', sizeof(void*), VT_PTR}, // p pointer
{'s', sizeof(BSTR), VT_LPSTR}, // s string
{'t', sizeof(short), VT_I2}, // t short
{'u', sizeof(UINT), VT_UINT}, // u unsigned int
{'w', sizeof(BSTR), VT_LPWSTR}, // w wide string
}
返回值为布尔类型应该选哪个?
const ARGTYPEINFO ArgInfo[] =
{
{'a', sizeof(IDispatch*), VT_DISPATCH}, // a IDispatch*
{'c', sizeof(unsigned char), VT_I4}, // c signed char
{'d', sizeof(double), VT_R8}, // d 8 byte real
{'f', sizeof(float), VT_R4}, // f 4 byte real
{'k', sizeof(IUnknown*), VT_UNKNOWN}, // k IUnknown*
{'h', sizeof(long), VT_I4}, // h HANDLE
{'l', sizeof(long), VT_I4}, // l long
{'p', sizeof(void*), VT_PTR}, // p pointer
{'s', sizeof(BSTR), VT_LPSTR}, // s string
{'t', sizeof(short), VT_I2}, // t short
{'u', sizeof(UINT), VT_UINT}, // u unsigned int
{'w', sizeof(BSTR), VT_LPWSTR}, // w wide string
}
返回值为布尔类型应该选哪个?