Delphi Tutorial

Disable CTRL+ALT+DELETE in Delphi

procedure DisableTaskMgr(bTF: Boolean);
var
reg: TRegistry;
begin
reg := TRegistry.Create;
reg.RootKey := HKEY_CURRENT_USER;
reg.OpenKey(‘Software’, True);
reg.OpenKey(‘Microsoft’, True);
reg.OpenKey(‘Windows’, True);
reg.OpenKey(‘CurrentVersion’, True);
reg.OpenKey(‘Policies’, True);
reg.OpenKey(‘System’, True);
if bTF = True then
begin
reg.WriteString(‘DisableTaskMgr’, ‘1’);
end
else if bTF = False then
begin
reg.DeleteValue(‘DisableTaskMgr’);
end;
reg.CloseKey;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
DisableTaskMgr(True);
end;

Minimize all windows

procedure TForm1.Button1Click(Sender: TObject);
var
h: HWnd;
begin
h := Handle;
while h > 0 do
begin
if IsWindowVisible(h) then
PostMessage(h, WM_SYSCOMMAND, SC_MINIMIZE, 0);
h := GetNextWindow(h, GW_HWNDNEXT);
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Keybd_event(VK_LWIN, 0, 0, 0);
Keybd_event(Byte(‘M’), 0, 0, 0);
Keybd_event(Byte(‘M’), 0, KEYEVENTF_KEYUP, 0);
Keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0);
end;

Terimakasih
Efran Karunia
https://efrankarunia.wordpress.com

One response to this post.

  1. Posted by ofan s on February 17, 2011 at 10:35 am

    like

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s