⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mydll.cpp

📁 经典的 读写usb设备的 dll
💻 CPP
字号:
#include "stdafx.h"
#include "mydll.h"
#include "USB.H"

static USBDevice JLJC;

/*
		temp = Device_Report[7] - 0x30;
		temp = temp * 10 + Device_Report[8] - 0x30;
		temp = temp * 10 + Device_Report[9] - 0x30;
		temp = temp * 10 + Device_Report[10] - 0x30;
		temp = temp * 10 + Device_Report[11] - 0x30;

		TempID = temp;

		temp =			    Device_Report[4] - 0x41;
		temp = temp * 100 + Device_Report[5] - 0x41;
		temp = temp * 100 + Device_Report[6] - 0x41;	
		CloseHandle(DeviceHandler);
*/


extern "C"__declspec(dllexport) bool GetReport(unsigned char report[])
{
	int	temp;
	if(JLJC.GetDeviceHandler())
	{ 
		//temp = temp * 10 + Device_Report[8] - 0x30;
		JLJC.WriteCommandToDevice(4);
		Sleep(10);
		return true;
	}
	else
		return false;

}

extern "C"__declspec(dllexport) unsigned long GetDeviceID0(void)
{
	unsigned long TempID;
	if(JLJC.GetDeviceHandler())
	{
		JLJC.WriteCommandToDevice(4);
		Sleep(10);
		TempID = JLJC.ReadIDData0();
		return(TempID);
	}
	else
		return 0;
}

extern "C"__declspec(dllexport) unsigned long WriteID0(void)
{
	if(JLJC.GetDeviceHandler())
	{ 
		JLJC.WriteCommandToDevice(6);
		Sleep(10);
		return 1;
	}
	else
		return 0;
}

extern "C"__declspec(dllexport) void WritePara(unsigned long x)
{
    JLJC.TempID = x;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -