Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2350384
  • 博文数量: 816
  • 博客积分: 10000
  • 博客等级: 上将
  • 技术积分: 5010
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-17 17:57
文章分类

全部博文(816)

文章存档

2011年(1)

2008年(815)

分类:

2008-12-17 18:07:23


我想在BCB中调用VC的DLL,但总不成功,有SiUSBXp.dll,SiUSBXp.lib,SiUSBXp.h,下面是SiUSBXp.h的源码,哪位能帮我看看,怎样调用,最好举个例子。
#ifdef SI_USB_XP_EXPORTS
#define SI_USB_XP_API __declspec(dllexport)
#else
#define SI_USB_XP_API __declspec(dllimport)
#endif

#define SI_RETURN_SERIAL_NUMBER 0x00
#define SI_RETURN_DESCRIPTION 0x01
#define SI_RETURN_LINK_NAME 0x02
#define SI_RETURN_VID 0x03
#define SI_RETURN_PID 0x04

#define SI_SUCCESS 0x00
#define SI_DEVICE_NOT_FOUND 0xFF
#define SI_INVALID_HANDLE 0x01
#define SI_READ_ERROR 0x02
#define SI_RX_QUEUE_NOT_READY 0x03
#define SI_WRITE_ERROR 0x04
#define SI_RESET_ERROR 0x05
#define SI_INVALID_PARAMETER 0x06
#define SI_INVALID_REQUEST_LENGTH 0x07
#define SI_DEVICE_IO_FAILED 0x08
#define SI_INVALID_BAUDRATE 0x09
#define SI_FUNCTION_NOT_SUPPORTED 0x0a
#define SI_GLOBAL_DATA_ERROR 0x0b
#define SI_SYSTEM_ERROR_CODE 0x0c
#define SI_READ_TIMED_OUT 0x0d
#define SI_WRITE_TIMED_OUT 0x0e

#define SI_RX_NO_OVERRUN 0x00

#define SI_RX_EMPTY 0x00
#define SI_RX_OVERRUN 0x01
#define SI_RX_READY 0x02

#define SI_MAX_DEVICE_STRLEN 256
#define SI_MAX_READ_SIZE 4096*16
#define SI_MAX_WRITE_SIZE 4096

typedef int SI_STATUS;
typedef char SI_DEVICE_STRING[SI_MAX_DEVICE_STRLEN];

#define SI_HELD_INACTIVE 0x00
#define SI_HELD_ACTIVE 0x01
#define SI_FIRMWARE_CONTROLLED 0x02
#define SI_RECEIVE_FLOW_CONTROL 0x02
#define SI_TRANSMIT_ACTIVE_SIGNAL 0x03

#define SI_STATUS_INPUT 0x00
#define SI_HANDSHAKE_LINE 0x01 // 01

#define SI_GPIO_0 0x01
#define SI_GPIO_1 0x02
#define SI_GPIO_2 0x04
#define SI_GPIO_3 0x08

#define SI_CP2101_VERSION 0x01
#define SI_CP2102_VERSION 0x02
#define SI_CP2103_VERSION 0x03





#ifdef __cplusplus
extern "C" {
#endif

SI_USB_XP_API
SI_STATUS WINAPI SI_GetNumDevices(
LPDWORD lpdwNumDevices
);

SI_USB_XP_API
SI_STATUS WINAPI SI_GetProductString(
DWORD dwDeviceNum,
LPVOID lpvDeviceString,
DWORD dwFlags
);

SI_USB_XP_API
SI_STATUS WINAPI SI_Open(
DWORD dwDevice,
HANDLE* cyHandle
);

SI_USB_XP_API
SI_STATUS WINAPI SI_Close(
HANDLE& cyHandle
);

SI_USB_XP_API
SI_STATUS WINAPI SI_Read(
HANDLE cyHandle,
LPVOID lpBuffer,
DWORD dwBytesToRead,
LPDWORD lpdwBytesReturned
);

SI_USB_XP_API
SI_STATUS WINAPI SI_Write(
HANDLE cyHandle,
LPVOID lpBuffer,
DWORD dwBytesToWrite,
LPDWORD lpdwBytesWritten
);

SI_USB_XP_API
SI_STATUS WINAPI SI_DeviceIOControl(
HANDLE cyHandle,
DWORD dwIoControlCode,
LPVOID lpInBuffer,
DWORD dwBytesToRead,
LPVOID lpOutBuffer,
DWORD dwBytesToWrite,
LPDWORD lpdwBytesSucceeded
);

SI_USB_XP_API
SI_STATUS WINAPI SI_FlushBuffers(
HANDLE cyHandle,
BYTE FlushTransmit,
BYTE FlushReceive
);

SI_USB_XP_API
SI_STATUS WINAPI SI_SetTimeouts(
DWORD dwReadTimeout,
DWORD dwWriteTimeout
);

SI_USB_XP_API
SI_STATUS WINAPI SI_GetTimeouts(
LPDWORD lpdwReadTimeout,
LPDWORD lpdwWriteTimeout
);
SI_USB_XP_API
SI_STATUS WINAPI SI_CheckRXQueue(
HANDLE cyHandle,
LPDWORD lpdwNumBytesInQueue,
LPDWORD lpdwQueueStatus
);
SI_USB_XP_API
SI_STATUS WINAPI SI_SetBaudRate(
HANDLE cyHandle,
DWORD dwBaud
);
SI_USB_XP_API
SI_STATUS WINAPI SI_SetBaudDivisor(
HANDLE cyHandle,
WORD wBaudDivisor
);
SI_USB_XP_API
SI_STATUS WINAPI SI_SetLineControl(
HANDLE cyHandle,
WORD wLineControl
);
SI_USB_XP_API
SI_STATUS WINAPI SI_SetFlowControl(
HANDLE cyHandle,
BYTE bCTS_MaskCode,
BYTE bRTS_MaskCode,
BYTE bDTR_MaskCode,
BYTE bDSR_MaskCode,
BYTE bDCD_MaskCode,
BOOL bFlowXonXoff
);

SI_USB_XP_API
SI_STATUS WINAPI SI_GetModemStatus (
HANDLE cyHandle,
PBYTE ModemStatus
);


SI_USB_XP_API
SI_STATUS WINAPI SI_ReadLatch(
HANDLE cyHandle,
LPBYTE lpbLatch
);

#ifdef __cplusplus
}
#endif


--------------------next---------------------

阅读(1778) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~