源代码如下生成.dll .lib)
1.MCDInterface.h
/*
*MCDInterface.h
*author:
*data:
*/
#ifndef MCDBOX_H_INCLUDED
#define MCDBOX_H_INCLUDED
#pragma once
#define MCD_IOCTRL_OPEN_SIG 0x1001
#define MCD_IOCTRL_CLOSE_SIG 0x1002
#define MCD_IOCTRL_FIND_SIG 0x1003
#define MCD_IOCTRL_READY 0x1003
#define MCD_IOCTRL_UNREADY 0x1004
#define KEY_0 0x3A
#define KEY_1 0x3B
#define KEY_2 0x3C
#define KEY_3 0x3D
#define KEY_4 0x3E
#define KEY_5 0x3F
#define KEY_6 0x40
#define KEY_7 0x41
#define KEY_8 0x42
#define KEY_9 0x43
#define KEY_STAR 0x44
#define KEY_POUND 0x45
#define MSG_HOOKOFF 0x16
#define MSG_HOOKON 0x12
#define MSG_RINGING 0x15
#define HID_DEVICE_REMOVE 0x76 //硬件被移走
#define CLIENT_READY_WRITE_SIG 0x92 //通知设备软件正在运行,每隔一段时间向缓冲区写该数据
#define DLL_EXPORT __declspec(dllexport)
#define DLL_IMPORT __declspec(dllimport)
//定义用于回调的枚举消息
enum{
MCD_CALLBACK_MSG_VERSION,//not used
MCD_CALLBACK_MSG_SERIALNO,//not used
MCD_CALLBACK_DEVICE_FOUND,
MCD_CALLBACK_DEVICE_NOT_FOUND,
MCD_CALLBACK_DEVICE_REMOVE,
MCD_CALLBACK_KEYDOWN,
MCD_CALLBACK_KEYBUFFER_CHANGED,
MCD_CALLBACK_HOOKOFF,
MCD_CALLBACK_HOOKON,
MCD_CALLBACK_RINGING,
MCD_CALLBACK_MSG_WARNING = -2,
MCD_CALLBACK_MSG_ERROR = -1,
};
DLL_EXPORT unsigned long MCD_DeviceIoControl(unsigned long dwIoControlCode,
void* lpInBuffer = 0, unsigned long nInBufferSize = 0,
void* lpOutBuffer = 0, unsigned long nOutBufferSize = 0);
//定义设备状态返回信息
enum{
MCD_RETURN_SUCCESS = 0,
MCD_RETURN_FOUND_HID,
MCD_RETURN_NO_FOUND_HID,
MCD_RETURN_HID_IS_OPENED,//?
MCD_RETURN_HID_NO_OPEN,//?
};
#endif // MCDBOX_H_INCLUDED
2.mcdHid.h
#ifndef MCDHID_H_INCLUDED
#define MCDHID_H_INCLUDED
extern "C"
{
#include "setupapi.h"
#include "hidsdi.h"
#include "dbt.h"
} |