System

Hide windows 95 taskbar

Posted in System

Taskbar windows name is 'Shell_TrayWnd'. So use Win32 function FindWindow to find Windows95 Taskbar, and Win32 function ShowWindow to it hide or restore. For example:

procedure TForm1.Button1Click(Sender: TObject);
var
  WindowHandle: HWnd;
begin
  WindowHandle:=FindWindow('Shell_TrayWnd','');
  if WindowHandle<>0 then 
    ShowWindow(WindowHandle,SW_HIDE);
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  WindowHandle: HWnd;
begin
  WindowHandle:=FindWindow('Shell_TrayWnd','');
  if WindowHandle<>0 then 
    ShowWindow(WindowHandle,SW_RESTORE);
end;

Hide start button

Posted in System

Use this procedure to hide (AVisible=True) or show (AVisible=False) the start button:

procedure TForm1.HideStartButton(AVisible: Boolean);
var
  Tray,Child,StartButtonHandle: HWnd;
  C: array[0..127] of Char;
  S: string;
begin
  Tray:=FindWindow('Shell_TrayWnd',nil);
  Child:=GetWindow(Tray,GW_CHILD);
  while Child<>0 do
  begin
    if GetClassName(Child,C,SizeOf(C))>0 then
    begin
      S:=StrPas(C);
      if UpperCase(S)='BUTTON' then
      begin
        StartButtonHandle:=Child;
        if AVisible then ShowWindow(Child,1)
        else ShowWindow(Child,0);
      end;
    end;
    Child:=GetWindow(Child,GW_HWNDNEXT);
  end;
end;

Hide icons on the Desktop

Posted in System

First of all, you should find handle of the window, which are the desktop. And after that, you may work with it like with any other window.

// Hide icons on the Desktop
procedure TForm1.Button2Click(Sender: TObject);
begin
  ShowWindow(DesktopListViewHandle, SW_HIDE);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  DesktopListViewHandle:=FindWindow('ProgMan', nil);
  DesktopListViewHandle:=GetWindow(DesktopListViewHandle, GW_CHILD);
  DesktopListViewHandle:=GetWindow(DesktopListViewHandle, GW_CHILD);
end;

// Show icons on the Desktop
procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowWindow(DesktopListViewHandle, SW_SHOW);
end;

Enable/disable CD autorun

Posted in System

Information about CD autorun is stored in the registry at "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\CDROM\AutoRun" path. If this parameter is 0, then autorun is disabled, if this parameter is 1, then autorun is enabled. Don't forget to add Registry in the uses chapter.

uses
  Registry;
...
procedure TForm1.Button1Click(Sender: TObject);
var
  i: Boolean;
begin
  i:=False;
  with TRegistry.Create do
  begin
    RootKey:=HKEY_LOCAL_MACHINE;
    if KeyExists('System\CurrentControlSet\Services\Class\CDROM')and
       OpenKey(
         'System\CurrentControlSet\Services\Class\CDROM', 
         False) then
      WriteBinaryData('AutoRun', i, 1);
  end;
end;

Disable/enable taskbar

Posted in System

Taskbar window name is 'Shell_TrayWnd'. Use FindWindow function to find Taskbar handle, and EnableWindow function to disable/enable taskbar. For example:

var
  TaskbarHandle: THandle;
...

procedure TForm1.FormCreate(Sender: TObject);
begin
  TaskbarHandle:=FindWindow('Shell_TrayWnd', nil);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  EnableWindow(TaskbarHandle, False);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  EnableWindow(TaskbarHandle, True);
end;