beamgun icon indicating copy to clipboard operation
beamgun copied to clipboard

Implement Keyboard Disabler

Open JLospinoso opened this issue 8 years ago • 0 comments

Sample:

#include "Windows.h"
#include <Ole2.h>
#include <SetupAPI.h>

int main() {
	const GUID KEYBOARD_CLASS_GUID = { 0x4D36E96B, 0xE325, 0x11CE, { 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18 } };
	auto devs = SetupDiGetClassDevs(&KEYBOARD_CLASS_GUID, NULL, 0, DICGF_PRESENT);
	auto devCount = 0;
	SP_DEVINFO_DATA devInfo;
	devInfo.cbSize = sizeof(SP_DEV_INFO_DATA);
	auto enumeratingDevices = true;
	while (enumeratingDevices) {
		enumeratingDevices = SetupDiEnumDeviceInfo(devs, devCount, &devInfo);
		if (enumeratingDevices) {
			auto res = SetupDiRemoveDevice(devs, &devInfo);
			devCount++;
		}
	}
	SetupDiDestroyDeviceInfoList(devs);
}

JLospinoso avatar Dec 08 '16 23:12 JLospinoso