屏闭2000XP2003系统的Ctrl+Alt+Del热键

    技术2022-05-11  98

    元旦,哪里也没去送你一个代码吧,LY可不是轻易给人写代码的下面的方法适合任何Windows NT平台(4.0以上)(至少目前的WinNT都能支持)NT4,2000,XP,2003全部OK的,而且没有窗口闪烁,呵呵,编译后的DLL才16K,好用得很的

    别问我怎么Inject DLL到EXE呀,嘻嘻:)

    元旦快乐,新年新气象~~~

    library SASWinHook;

    {  SASWinHook  copyrights by Liu Yang LYSoft http://lysoft.7u7.net 2006.1.1

      usage: only need to inject this dll to WinLogon.exe}

    uses Windows, Messages;

    {$R *.res}

    var  FHandle: THandle;  OldAppProc: Pointer;

    function HookProc(hHandle: THandle; uMsg: Cardinal;  wParam, lParam: Integer): LRESULT; stdcall;var K, C: Word;  // wndprocbegin  if uMsg = WM_HOTKEY then     begin        K := HIWORD(lParam);        C := LOWORD(lParam);        // press Ctrl + Alt + Del        if (C and VK_CONTROL<>0) and (C and VK_MENU <>0) and ( K = VK_DELETE)           then Exit;   // disable Ctrl + Alt + Del     end;  Result := CallWindowProc(OldAppProc, hHandle,    uMsg, wParam, lParam);end;

    procedure EntryPointProc(Reason: Integer);begin  case reason of    DLL_PROCESS_ATTACH:      begin  // hook SAS window wndproc        FHandle := FindWindow('SAS window class', 'SAS window');        if not IsWindow(FHandle) then Exit;  // is window found?        // save old wndproc        OldAppProc := Pointer(GetWindowLong(FHandle, GWL_WNDPROC));        // set new wndproc        SetWindowLong(FHandle, GWL_WNDPROC, Cardinal(@HookProc));      end;    DLL_PROCESS_DETACH:      begin        if FHandle > 0 then           begin  // unhook             if Assigned(OldAppProc) then                SetWindowLong(FHandle, GWL_WNDPROC, LongInt(OldAppProc));             OldAppProc := nil;           end;      end;    end;end;

    begin  OldAppProc := nil;  FHandle := 0;  DllProc := @EntryPointProc;  EntryPointProc(DLL_PROCESS_ATTACH);end.


    最新回复(0)