gpt4 book ai didi

windows - 交换 alt 键功能

转载 作者:可可西里 更新时间:2023-11-01 09:38:27 24 4
gpt4 key购买 nike

我需要在 Windows 7 中交换 Alt 键功能。一家大公司需要为在打字机上书写的老人提供此功能,打字机左侧有变音符号键,但 Win7 是为此目的,现在正在处理具有正确的 Alt

经过两天的研究,我找到了一个驱动程序解决方案。我需要原始 Windows 7 驱动程序的源代码(两个 .sys 文件似乎是键盘驱动程序),并可能在 Windows DDK 中修改它们。或者我需要制作一个可以与默认驱动程序一起使用的额外驱动程序。如我所见,解决方案将使用 C 或 C++。但是我必须走什么路才能做到这一点?我应该采取什么步骤?

限制是:

  1. 一次系统重启仅用于驱动程序安装。
  2. 一种在 Win7 中工作时交换 Alt 键的简单方法(通过同时按下 Alt 键来交换它们)。
  3. 没有需要重新启动的 Win7 键盘重新映射。

稍后添加:我拥有我需要的一切,但没有处理交换的代码。例如,我为右 ShiftEnter 做了一个切换,因为只发送了一个扫描码。但是左 Alt 发送一个和右 Alt 发送两个扫描码:

VOID
KbFilter_ServiceCallback(
IN PDEVICE_OBJECT DeviceObject,
IN PKEYBOARD_INPUT_DATA InputDataStart,
IN PKEYBOARD_INPUT_DATA InputDataEnd,
IN OUT PULONG InputDataConsumed
)
/*++

Routine Description:

Called when there are keyboard packets to report to the Win32 subsystem.
You can do anything you like to the packets. For instance:

o Drop a packet altogether
o Mutate the contents of a packet
o Insert packets into the stream

Arguments:

DeviceObject - Context passed during the connect IOCTL

InputDataStart - First packet to be reported

InputDataEnd - One past the last packet to be reported. Total number of
packets is equal to InputDataEnd - InputDataStart

InputDataConsumed - Set to the total number of packets consumed by the RIT
(via the function pointer we replaced in the connect
IOCTL)

Return Value:

Status is returned.

--*/
{
PDEVICE_EXTENSION devExt;
WDFDEVICE hDevice;

hDevice = WdfWdmDeviceGetWdfDeviceHandle(DeviceObject);

devExt = FilterGetData(hDevice);

if (InputDataStart->MakeCode==0x1c)
InputDataStart->MakeCode=0x36;
else if (InputDataStart->MakeCode==0x36)
InputDataStart->MakeCode=0x1c;
else if (InputDataStart->MakeCode==0x9c)
InputDataStart->MakeCode=0xb6;
else if (InputDataStart->MakeCode==0xb6)
InputDataStart->MakeCode=0x9c;

(*(PSERVICE_CALLBACK_ROUTINE)(ULONG_PTR) devExt->UpperConnectData.ClassService)(
devExt->UpperConnectData.ClassDeviceObject,
InputDataStart,
InputDataEnd,
InputDataConsumed);
}

所以我只是交换了分别按下和释放两个键的扫描码。右 Alt 正在发送两个扫描码,我不确定它是通过两次调用此函数来实现的,还是在 InputDataStart 结构中生成两个扫描码。我会尝试发出每个 Alt 扫描码的蜂鸣声,但非常感谢您的帮助。

最佳答案

解决方法:

if (InputDataStart->MakeCode==0x38 || InputDataStart->MakeCode==0xb8)
InputDataStart->Flags^=KEY_E0;

交换左右 Alt 键功能。

现在我需要使交换可配置。为了获得最佳效果 - 按两个 Alt 键。

关于windows - 交换 alt 键功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12612355/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com