vc代码改成c#(winform),重谢(150分,先给100,后补50)。急,谢谢
#ifndef RS_BD1API_H__#define RS_BD1API_H__
#ifdef RSMANAGER_EXPORTS
#define RS_BD1API __declspec(dllexport)
#else
#define RS_BD1API __declspec(dllimport)
#endif
#include <windows.h>
#include <time.h>
#ifndef UINT8
#define UINT8 unsigned char
#endif
#ifndef UINT16
#define UINT16 unsigned short
#endif
#ifndef UINT32
#define UINT32 unsigned int
#endif
#ifndef INT16
#define INT16 short
#endif
extern "C"
{
#pragma pack(push,4) // 保存原来的对齐方式,设置4字节对齐
typedef struct tagRSPacketHead
{
char ExtFlag; // 扩展标志
char Head[10]; // 包头
char HeadMsg[30]; // 包头含义
int FunID; // 对应的功能号
} RS_PACKET_HEAD;
typedef struct tagRSLogMsg
{
int OK;
RS_PACKET_HEAD Head;
char szTime[32];
char *Data;
int DataLen;
char *DataMsg;
char *Cmd;
short CmdLen;
UINT8 CmdFreq;
} RS_LOG_MSG,*LPRS_LOG_MSG;
// 日志消息的收发标志(WPARAM)
#define RS_MSG_RECV 0
#define RS_MSG_SEND 1
// 初始化函数的返回码
#define RS_ERR_INIT_OK 0
#define RS_ERR_INIT_PORT -1
#define RS_ERR_INIT_DEVIDE -2
#define RS_ERR_INIT_DECODE -3
#define RS_ERR_INIT_ENCODE -4
#define RS_ERR_INIT_FUNC -5
#define RS_ERR_INIT_DEV -6
RS_BD1API int __stdcall RSInitDev(char *Port, char *Dev, HWND hWnd=NULL,DWORD MsgID=NULL);
RS_BD1API void __stdcall RSFreeDev();
RS_BD1API bool __stdcall RSOpenPort(char *Port);
RS_BD1API bool __stdcall RSDataMsg(int DataType, HWND hWnd, UINT MsgID);
typedef void (CALLBACK * RS_DATA_CALLBACK) (WPARAM WPARAM,LPARAM LPARAM);
RS_BD1API bool __stdcall RSDataCallBack(RS_DATA_CALLBACK DataCallBack);
#define RS_CMD_RAW 0
enum RS_FREQ
{
RS_FREQ_NONE,
RS_FREQ_ONCE,
RS_FREQ_TWICE,
};
#define RS_ERR_CMD_NOTNEED 0
#define RS_ERR_CMD_UNKNOWN -1
#define RS_ERR_CMD_INVALID -2
RS_BD1API int __stdcall RSSendCmd(int CmdType, void *Param, int Size, int Freq=RS_FREQ_NONE);
RS_BD1API int __stdcall RSParamSet(char *szParamName, void *Param,int ParamLen);
RS_BD1API int __stdcall RSParamSetByID(int nParamID, void *Param,int ParamLen);
RS_BD1API bool __stdcall RSParamGet(char *szParamName, void *Param,int *ParamLen);
RS_BD1API bool __stdcall RSParamGetByID(int nParamID, void *Param,int *ParamLen);
RS_BD1API bool __stdcall RSSetTimeOut(int TimeOut);
RS_BD1API bool __stdcall RSIsTimeOut(bool *Result);
typedef struct tagMsgLength
{
int ptHzCount;
int ptDmCount;
int tkHzCount;
int tkDmCount;
} RS_MSG_LENGTH;
RS_BD1API bool __stdcall RSMsgLength(int Grade, int Encrypt, RS_MSG_LENGTH *MsgLen);
#define DRV_DLL_COUNT 10
typedef struct tagDevVersion
{
char FileName[20];
UINT8 Version[4];
UINT8 LastTime[6];
} DEV_VERSION;
typedef struct tagDeviceCfg
{
UINT8 ManCRCIgnore;
UINT8 GPSEnable;
UINT8 CardCount;
UINT8 ZeroValueFlag;
DWORD ZeroValueR3;
UINT8 IsProt21;
UINT8 UpdateCount;
UINT16 UpdateSize;
UINT16 BeamFlag;
DEV_VERSION DLLVers[DRV_DLL_COUNT];
char Version[12];
int Baud;
int RawSize;
int DatSize;
int MsgSize;
} RS_DEVICE_CFG;
#define RS_DEVICE_CFG_ZERO_SX 0x01
#define RS_DEVICE_CFG_ZERO_DX 0x02
#define RS_DEVICE_CFG_BEAM_MAIN 0x8000
#define RS_DEVICE_CFG_BEAM_DIFF 0x4000
#define RS_DEVICE_CFG_BEAM_AUTO 0x2000
RS_BD1API bool __stdcall RSDeviceCfg(RS_DEVICE_CFG *cfg);
RS_BD1API int __stdcall RSDeviceBauds(char *Dev,int *Bauds,int MaxCount);
#pragma pack(pop)
}
#endif // RS_BD1API_H__ --------------------编程问答-------------------- 直接封装成一个dll不就行了? --------------------编程问答-------------------- 这个就一个头文件 对着申明改改语法就行了 又没有具体实现 还有问题? --------------------编程问答-------------------- 也用C#做个视频监控客户端来玩玩
补充:.NET技术 , C#