请问在2K下面如何屏蔽掉Win键,如果分数不够,可以再给.

解决方案 »

  1.   

    在DELPHIBBS中看到类似的问题,,有高手说用HOOK技术来屏。。代码没有保存,,很可惜,看看楼下的朋友吧。
      

  2.   

    type
      PKBDLLHOOKSTRUCT = ^TKBDLLHOOKSTRUCT;
      TKBDLLHOOKSTRUCT = record
        vkCode,
        scanCode,
        flags,
        time:        DWORD;
        dwExtraInfo: Pointer;
      end;const
      WH_KEYBOARD_LL = 13;
    function LowLevelKeyboardProc(nCode:integer;WParam:WPARAM;LParam:LPARAM):LRESULT;stdcall;
    var
      fEatKeystroke:BOOL;
      p:PKBDLLHOOKSTRUCT;
    begin
      result:=0;
      fEatKeystroke := false;
      p:=PKBDLLHOOKSTRUCT(lparam);
      if (ncode=HC_ACTION) then
      begin
        case wparam of
          WM_KEYDOWN,
          WM_SYSKEYDOWN,
          WM_KEYUP,
          WM_SYSKEYUP:
            featkeystroke :=(p.vkcode = VK_Lwin) or (p.vkcode = VK_Rwin)or (p.vkcode = VK_apps);
        end;
      end;
      if featkeystroke = true then
        result:=1;
      if ncode <> 0 then
        result := callnexthookex(0,ncode,wparam,lparam);
    end;procedure TForm1.FormCreate(Sender: TObject);
    var hhklowlevelkybd: HHOOK;
    begin
      hhklowlevelkybd := SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, HInstance, 0);
    end;