AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Projekte Unit zum sperren verschiedener Systemfunktionen
Thema durchsuchen
Ansicht
Themen-Optionen

Unit zum sperren verschiedener Systemfunktionen

Ein Thema von thomasdrewermann · begonnen am 8. Jun 2002 · letzter Beitrag vom 11. Feb 2004
 
Benutzerbild von thomasdrewermann
thomasdrewermann

Registriert seit: 8. Jun 2002
Ort: Herne
575 Beiträge
 
Delphi 3 Professional
 
#11
  Alt 16. Jun 2002, 10:57
Genau so hab ichs gemacht, bloss sie laueft unter XP nicht:

Code:
unit lockit;

interface


uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Buttons, Tlhelp32;



  const
  WM_HOOKCREATE = WM_USER + 1;

  function SetHook(WinHandle: HWND; MsgToSend: integer): boolean; stdcall; external 'winhook.dll';
  function FreeHook: boolean; stdcall; external 'winhook.dll';
  procedure HideTaskbar;
  procedure ShowTaskbar;
  procedure lockwindowskey;
  procedure freewindowskey;
  procedure lockalttab;
  procedure freealttab;
  procedure showwindowsbutton;
  procedure hidewindowsbutton;
  function KillTask(ExeFileName: string): integer;

var     FHookSet: Boolean;
implementation
  procedure HideTaskbar;
  var
    wndHandle : THandle;
    wndClass : array[0..50] of Char;
begin
  StrPCopy(@wndClass[0], 'Shell_TrayWnd');
  wndHandle := FindWindow(@wndClass[0], nil);
  ShowWindow(wndHandle, SW_HIDE); {This hides the taskbar}
end;
procedure ShowTaskbar;
  var
    wndHandle : THandle;
    wndClass : array[0..50] of Char;
begin
  StrPCopy(@wndClass[0], 'Shell_TrayWnd');
  wndHandle := FindWindow(@wndClass[0], nil);
  ShowWindow(wndHandle, SW_RESTORE); {This restores the taskbar}
end;

procedure lockwindowskey;
var handle:thandle;
begin
  FHookSet := LongBool(SetHook(Handle,WM_HOOKCREATE));
end;

procedure freewindowskey;
begin
  FHookSet := FreeHook;
end;

procedure lockalttab;
var OldVal : LongInt;
begin
  SystemParametersInfo (97, Word (True), @OldVal, 0);
end;

procedure freealttab;
var OldVal : LongInt;
begin
  SystemParametersInfo (97, Word (false), @OldVal, 0);
end;

procedure showwindowsbutton;
begin
  EnableWindow(FindWindowEx(FindWindow
  ('Shell_TrayWnd', nil), 0,'Button',nil),true);
end;

procedure hidewindowsbutton;
begin
  EnableWindow(FindWindowEx(FindWindow
  ('Shell_TrayWnd', nil), 0,'Button',nil),false);
end;

function KillTask(ExeFileName: string): integer;
const
PROCESS_TERMINATE=$0001;
var
ContinueLoop: BOOL;
FSnapshotHandle: THandle;
FProcessEntry32: TProcessEntry32;
begin
result := 0;

FSnapshotHandle := CreateToolhelp32Snapshot
(TH32CS_SNAPPROCESS, 0);
FProcessEntry32.dwSize := Sizeof(FProcessEntry32);
ContinueLoop := Process32First(FSnapshotHandle,
FProcessEntry32);

while integer(ContinueLoop) <> 0 do
begin
if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
UpperCase(ExeFileName))
or (UpperCase(FProcessEntry32.szExeFile) =
UpperCase(ExeFileName))) then
Result := Integer(TerminateProcess(OpenProcess( 
PROCESS_TERMINATE, BOOL(0),
FProcessEntry32.th32ProcessID), 0));
ContinueLoop := Process32Next(FSnapshotHandle,
FProcessEntry32);
end;

CloseHandle(FSnapshotHandle);
end;






end.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:54 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz