作者Lucemia (生の直感、死の予感)
看板C_Sharp
标题Re: [问题] C++转C#结构
时间Tue Jul 21 10:59:07 2009
※ 引述《gd3727 (灿烂流星)》之铭言:
: 请问C#要如何引用下面的 C++ 方法与指标结构?
: //bt_api.h (coredll.dll)
: HANDLE RegisterBluetoothCOMPort
: (
: LPCWSTR lpszType, // "BSP" or "COM"
: DWORD dwIndex, // device index
: PORTEMUPortParams* pParams // BT specific params
: );
: typedef struct _portemu_port_params {
: int channel;
: int flocal;
: BT_ADDR device;
: int imtu;
: int iminmtu;
: int imaxmtu;
: int isendquota;
: int irecvquota;
: GUID uuidService;
: unsigned int uiportflags;
: } PORTEMUPortParams;
: //ws2bth.h
: typedef ULONGLONG bt_addr, *pbt_addr, BT_ADDR, *PBT_ADDR;
: 我只懂得…
: [DllImport("coredll")]
: private static extern int RegisterBluetoothCOMPort(
: string lpszType,
: uint dwIndex,......
: 接下来就不知道怎麽改写了…。谢谢。
[StructLayout(LayoutKind.Sequential)]
public _portemu_port_params
{
public int channel;
...
}
可能需要条 structLayout 里面的变数
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 154.20.172.64