ご挨拶、
here で説明されているように、低レベルのキーボード フックを実装しました。これは WinXP で問題なく動作します。問題は、Windows 7 では左右の Windows キーが傍受されなくなったことです。
Windows 7 でこれらのキーを再取得する方法についての提案は大歓迎です!
乾杯、
ロニー
ご挨拶、
here で説明されているように、低レベルのキーボード フックを実装しました。これは WinXP で問題なく動作します。問題は、Windows 7 では左右の Windows キーが傍受されなくなったことです。
Windows 7 でこれらのキーを再取得する方法についての提案は大歓迎です!
乾杯、
ロニー
多くの場合、通常のフックが機能しなかったため、ライブラリを構築しました。そのため、内部でフィルター ドライバーと通信してデバイス入力インターセプトの作業を行うための ac ライブラリを構築しました。このライブラリを使用して Windows キーをキャプチャする方法のサンプルを次に示します。
#include <iostream>
#include <interception.h>
#include "utils.h" // for process priority control
const InterceptionKeyStroke windows_key_down = {91, INTERCEPTION_KEY_E0 | INTERCEPTION_KEY_DOWN};
const InterceptionKeyStroke windows_key_up = {91, INTERCEPTION_KEY_E0 | INTERCEPTION_KEY_UP};
bool operator == (const InterceptionKeyStroke &left, const InterceptionKeyStroke &right)
{
return left.code == right.code && left.state == right.state;
}
int main()
{
using namespace std;
InterceptionContext context;
InterceptionDevice device;
InterceptionStroke stroke;
raise_process_priority();
context = interception_create_context();
interception_set_filter(context, interception_is_keyboard, INTERCEPTION_FILTER_KEY_ALL);
while(interception_receive(context, device = interception_wait(context), &stroke, 1) > 0)
{
InterceptionKeyStroke &keystroke = *(InterceptionKeyStroke *) &stroke;
if(keystroke == windows_key_down)
cout << "Windows Key Down" << endl;
if(keystroke == windows_key_up)
cout << "Windows Key Up" << endl;
interception_send(context, device, &stroke, 1);
}
interception_destroy_context(context);
return 0;
}
サンプルはキーをキャプチャしてオペレーティング システムに送り返しますが、代わりに他のことを行うこともできます。
http://oblita.com/Interceptionでその他のドキュメントを確認できます。
Win Kernel SDK for Windows 7を見て、これもフックする「ドライバー」をプログラムしてください。