※ 引述《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