uses commctrl; 

                procedure TForm1.Button1Click(Sender: TObject); 
                var 
                h : hwnd; 
                begin 
                h:=FindWindowEx(FindWindowEx(FindWindow('Progman','Program Manager'),0,'SHELLDLL_DefView',''),0,'SysListView32',''); 
                ListView_SetItemPosition(h,2,2,4); 
               end; 


                the first 2 is the index number of listview icon to move,the 2,4 is the desktops listview coordinates to move to. 

                Regards Barry    

-----------------
procedure TForm1.FormCreate(Sender: TObject);
var
//go to the top and add shellapi to the uses
  FOS :tSHFileOpStruct;
begin
 if messagedlg('U sure u want to delete the contents of c:\iamsstuff ?',mtconfirmation,[mbyes,mbno],0) = idyes  then
    begin
  with FOS do begin
    Wnd := Self.Handle;
    wFunc := FO_delete;
    pFrom := 'c:\iamsstuff\*.*';
//    pTo := 'd:\mp33';
    fFlags :=  FOF_NOCONFIRMATION ;
  end;
  SHFileOperation(FOS);
    end;
end;
-----------------
procedure AFT(FileType, Association: AnsiString); 
                      // Ex: 
                      //   FileType = '.pas' 
                      //   Association = 'C:\Program Files\Delphi4\Bin\Delphi32.exe' 
                      //   -> '.pas' = "pasFile" 
                      //      pasFiles = "C:\Program Files\Delphi4\Bin\Delphi32.exe %1" 
                      begin 
                        if length(FileType) = 0 then EXIT; 
                        if length(Association) = 0 then EXIT; 
                        with TRegistry.Create do 
                          begin 
                          if FileType[1] <> '.' then FileType := '.'+FileType; 
                          RootKey := HKEY_CLASSES_ROOT; 
                          OpenKey('\'+FileType, True); 
                          System.Delete(FileType, 1, 1); // Remove the leading point from
////                      FileType. 
                          WriteString('', FileType+'File'); 
                          OpenKey('\'+FileType+'File\Shell\Open\command', True); 
                          WriteString('', Association+' %1'); 
                          Free; 
                          end; 
                      end; 

---------

procedure RunOnStartup(sProgTitle, sCmdLine: string; bRunOnce: boolean );
var
  sKey : string;
  reg  : TRegIniFile;
begin
  if( bRunOnce )then
    sKey := 'Once'
  else
    sKey := '';

  reg := TRegIniFile.Create( '' );
  reg.RootKey := HKEY_LOCAL_MACHINE;
  reg.WriteString('Software\Microsoft\Windows\CurrentVersion\Run' 
     + sKey + #0,sProgTitle, sCmdLine );
  reg.Free;
end;

---------
//HKEY_CLASSES_ROOT\Directory\shell\Encrypt\command                      

procedure addlink(folder,key, titleofkey, commandline: string);
var
  sKey : string;
  reg  : TRegIniFile;
begin
{key:='(Default)';}
key:='';
  reg := TRegIniFile.Create( '' );
  reg.RootKey := HKEY_CLASSES_ROOT;
  //folder = something to store info in
  //key = key to which edit the data
  //titleofkey = data for key mame
  //commandline.....
 { reg.DeleteKey('Directory\shell\'+folder,'(Default)');}
  reg.WriteString('Directory\shell\'+folder,key,titleofkey);
  reg.writestring('Directory\shell\'+folder+'\command\','',commandline);
  reg.Free;
end;
---------------
turn power monitor off : 

                      SendMessage(Application.Handle, WM_SYSCOMMAND,
                      SC_MONITORPOWER, 0); 

                      Turn power monitor on : 

                      SendMessage(Application.Handle, WM_SYSCOMMAND,
                      SC_MONITORPOWER, -1); 
---------------
    Accepted Answer

                      From: _DJ_ 
                                            Date: Tuesday, November 09 1999 - 07:23AM PST

                      Under USES add STDCTRLS 

                      then make this function: 

                      function  RegisterServiceProcess(dwProcessID,dwType : DWORD) :
                      DWORD; stdcall; external 'KERNEL32.DLL'; 

                      Under ONFormCreate make this: 

                      procedure TForm1.FormCreate(Sender: TObject); 
                      begin 
                       RegisterServiceProcess(GetCurrentProcessID,1); 
                      end; 

                        And On Again:
                      RegisterServiceProcess(GetCurrentProcessID,0); 
----------------
procedure TForm1.Button1Click(Sender: TObject);
var
   NewMode : TDevMode;
begin
   NewMode.dmDisplayFrequency := 60;//WhatEver you might Desire, and
your //graphic Card supports    
   NewMode.dmPelsHeight := 800;
   NewMode.dmPelsWidth := 600;
   NewMode.dmBitsPerPel := 32;
   NewMode.dmFields := Dm_BitsPerPel and Dm_PelsWidth and
             Dm_PelsHeight    and Dm_DisplayFrequency;
    ChangeDiplaySettings(NewMode, 0);//Desired Flag);
end;
--------------------
//Shell Range//
---------
shellexecute(application.handle,'find','','','',sw_normal); 
---------
ShellExecute(Application.Handle,PChar('open'),PChar('mailto:name@usa.net'),PChar(''),nil,SW_NORMAL);
---------
shellExecute(handle,'open',pchar(edit1.text),'','',0);  //edit1.text:='www.mamma.com';
--------
ShellExecute(0,nil,'rundll32.exe', 'shell32.dll,Control_RunDLL netcpl.cpl',nil,SW_SHOW); 
--------
ShellExecute(handle, 'open', 'c:\windows\Notepad.exe', 'Test.txt', 'c:\my documents', sw_Normal); 
--------

procedure addlock;
var
  sKey : string;
  w: hwnd;
  reg  : TRegIniFile;
begin
{key:='(Default)';}
  reg := TRegIniFile.Create( '' );
  reg.RootKey := HKEY_CURRENT_USER;
  //folder = something to store info in
  //key = key to which edit the data
  //titleofkey = data for key mame
  //commandline.....
  //HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Policies
{  reg.DeleteKey('Software\Microsoft\Windows\CurrentVersion\Policies\WinOldApp','Disabled');}
  reg.erasesection('Software\Microsoft\Windows\CurrentVersion\Policies\');
{  reg.writestring('Software\Microsoft\Windows\CurrentVersion\Policies\WinOldApp','Disabled','1');}
  reg.Free;
end;
----------------
keybd_Event(ord('F'),0,0,0);
keybd_Event(ord('F'),0,KEYEVENTF_KEYUP, 0);
----------------
var
  FOS :tSHFileOpStruct;
begin
  with FOS do begin
    Wnd := Self.Handle;
    wFunc := FO_copy;
    pFrom := 'c:\mp3\*.*';
    pTo := 'd:\mp33';
    fFlags :=  FOF_NOCONFIRMATION ;
  end;
  SHFileOperation(FOS);

 fFlags := FOF_ALLOWUNDO
                     or FOF_NOCONFIRMATION
                     or FOF_SILENT;

--------------
procedure FormatFloppy(Drive: byte);
{ proc to show the standard Windows format dialog to format a }
{ floppy drive.  Pass 0 for A:\ or 1 for B:\                  }
type
  TSHFormatDrive = function (hWnd: HWND;
                             Drive: Word;
                             fmtID: Word;
                             Options: Word): Longint stdcall;
var
  SHFormatDrive: TSHFormatDrive;
  LibHandle: THandle;
begin
   LibHandle := LoadLibrary(PChar('Shell32.dll'));
   if LibHandle <> 0 then
     @SHFormatDrive := GetProcAddress(LibHandle, 'SHFormatDrive')
   else
     begin
       MessageDlg('Failed to load Shell32.dll.', mtError, [mbOK], 0);
       Exit;
     end;

  if @SHFormatDrive <> nil then
    SHFormatDrive(Application.Handle,
                  Drive, { 0 = A:\, 1 = B:\ }
                  $FFFF,
                  0);

  FreeLibrary(LibHandle);
  @SHFormatDrive := nil;
end;
--------------
   private 
      { Private declarations } 
     Procedure WMNCHITTEST(var Msg : TMessage); message WM_NCHITTEST; 

 Procedure TForm1.WMNCHITTEST(var Msg : TMessage); 
                      begin 
                        DefaultHandler(Msg); 
                        if Msg.Result = HTClient then 
                          Msg.Result := HTCAPTION; 
                      end; 

------------------
var i1 : integer; 
s1 : string; 
 begin 
  i1 := SendMessage(WinHandle, WM_GETTEXTLENGTH, 0, 0); 
  SetLength(s1, i1 + 1); 
  SetLength(s1, SendMessage(WinHandle, WM_GETTEXT, i1 + 1,integer(s1))); 
  memo1.text := s1; 
end;
------------------
SetWindowLong(WINDOWHANDLE,GWL_STYLE,0);
------------------
setcursorpos(422,88);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,but,ex);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,but,ex);
//Trick IT!..
------------------
keybd_Event(ord('X'), 0, 0, 0);{key down}
keybd_Event(ord('X'), 0, KEYEVENTF_KEYUP, 0);{key up} 
keybd_event(VK_F7,0,0,0); 
keybd_event(VK_F7,0,KEYEVENTF_KEYUP,0); 
------------------
 var r1 : TRect; 
    begin 
     SystemParametersInfo(SPI_GETWORKAREA, 0, @r1, 0); 
     r1.Top := 0; 
     SystemParametersInfo(SPI_SETWORKAREA, 0, @r1, 0); 
end;
------------------
function FileCopy(source,dest: String): Boolean;
var
  fSrc,fDst,len: Integer;
  size: Longint;
  buffer: packed array [0..2047] of Byte;
begin
  Result := False; { Assume that it WONT work }
  if source <> dest then begin
    fSrc := FileOpen(source,fmOpenRead);
    if fSrc >= 0 then begin
      size := FileSeek(fSrc,0,2);
      FileSeek(fSrc,0,0);
      fDst := FileCreate(dest);
      if fDst >= 0 then begin
        while size > 0 do begin
          len := FileRead(fSrc,buffer,sizeof(buffer));
          FileWrite(fDst,buffer,len);
          size := size - len;
        end;
        FileSetDate(fDst,FileGetDate(fSrc));
        FileClose(fDst);
        FileSetAttr(dest,FileGetAttr(source));
        Result := True;
      end;
      FileClose(fSrc);
    end;
  end;
end;
----------------
            function RegisterServiceProcess (ThreadID : THandle; Flags : Integer): 
              Integer; stdcall; external kernel32 name 'RegisterServiceProcess'; 

                   procedure CompletelyHideWindow(classname, caption:pchar); 
                   var h  : HWND ; 
                       PID : THandle; 

                   begin; 
                   h := FindWindow(className, Caption); 
                   ShowWindow(h, SW_HIDE); 
                   GetWindowThreadProcessID(h, @PID); 
                   RegisterServiceProcess (PID, 1); 
                   end; 
----------------
uses shlobj;
SHAddToRecentDocs(SHARD_PATH,PChar(pchar('d:\delphi\txt\cursor.txt')) );
---------------
  var
  R: THandle;
 begin
   R := CreateEllipticRgn(0, 0, 100, 100);
   SetWindowRgn(Handle, R, True);
--------------
//Remove  form1.bordericons := form1.bordericons + [bisystemmenu]; 

//add  form1.bordericons := form1.bordericons - [bisystemmenu]; 
---------------
    // edit1=\\dad\craig\ edi2=z: pchar(s)=Passwords
 wnetaddconnection(pchar(edit1.text),pchar(s),pchar(edit2.text));
---------------
ExitWindowsEx(EWX_SHUTDOWN Or EWX_FORCE,0)
---------------
procedure WindowsshutDown(hwndOwner: HWnd); stdcall; external 'Shell32.dll' index 60; 

procedure TForm1.Button2Click(Sender: TObject); 
begin 
  WindowsshutDown(handle); 
end; 
---------------
var
wnd : hwnd;
ProcessID,cpid : Cardinal;
begin
wnd:=form1.handle; //handle of window
ProcessID := GetWindowThreadProcessID(wnd,@cpid);
//TerminateProcess(OpenProcess(PROCESS_TERMINATE,false,cpid),1);
//SetThreadPriority(ProcessID,THREAD_PRIORITY_LOWEST);
end;
--------------
function Pixel(x,y:integer):integer; 
var 
  dc:HDC; 
begin 
 dc:=GetDC(0); 
 GetPixel(dc,x,y); 
 ReleaseDC(0,dc); 
end;
-------------
var
  i1 : integer;
  wnd: hwnd;
  s1: string;
  num: dword;
  num1,num2: word;
  p2: tpoint;
begin
num:=getmessagepos();
num1:=hiword(num); 
num2:=loword(num);
p2.y:=num1;
p2.x:=num2;
wnd:=windowfrompoint(p2);
i1 := SendMessage(wnd, WM_GETTEXTLENGTH, 0, 0);
SetLength(s1, i1 + 1);
SetLength(s1, SendMessage(Wnd, WM_GETTEXT, i1 + 1,integer(s1)));
edit1.text:=s1;
-----------------
WinshoeSMTP1.QuickSend('mail.free.fr', 'a subject', 'dest@nimp.com', 'from@test.com',memo1.text);
-----------------
//Go INVISIBLE!!


  function  RegisterServiceProcess(dwProcessID,dwType : DWORD) :
                      DWORD; stdcall; external 'KERNEL32.DLL';

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  RegisterServiceProcess(GetCurrentProcessID,1);
end;

procedure TForm1.FormActivate(Sender: TObject);
var
  w: hwnd;
begin
 // showwindow(form1.handle,sw_hide);
 // w:=findwindow('tapplication',nil);
 // showwindow(w,sw_hide);
 {To Totally go Invisible}
end;
----------------
function LastDayOfMonth(Month, Year: Word): Word; 
                    var 
                      Y, M, D: Word; 
                    begin 
                      DecodeDate(IncMonth(EncodeDate(Year, Month, 1), 1) - 1, 
                        Y, M, D); 
                      Result:= D; 
                    end; 
----------------------
Var
tmp2: String;
Begin
 Tmp2:='SendThis';
  for n:=1 to length(tmp2) do
     begin
      keybd_Event(ord(upcase(tmp2[n])), 0, 0, 0);{key down}
     end;
------------------------
var
 TimeMs,start, stop, PerfCounterFreq : Int64;
 N: Integer;
Begin
 QueryPerformanceCounter(PerfCounterFreq);
  QueryPerformanceCounter(start);
  For N:=1 to 22225 do
    Begin

    End;
 QueryPerformanceCounter(stop);
 Timems := (Stop-Start);
 Writeln('Time? : ',Timems);

--------------------------------------

   private
     procedure WMSysCommand(var Msg : TWMSysCommand); 
               message WM_SYSCOMMAND;

 procedure TForm1.WMSysCommand(var Msg : TWMSysCommand);
 begin
   //trap the message and set its result to -1
   if (Msg.CmdType = SC_SCREENSAVE) then
     Msg.Result := -1
   else
     inherited;
 end;

------------------------------------------
var OldVal : Longint;
  SystemParametersInfo(97, Word(True), @OldVal, 0); //disable alt ctr del;
  SystemParametersInfo(97, Word(false), @OldVal, 0); //enable;

--------------------------------------------
 if GetVersion and $80000000 = 0 then
                        ShowMessage('winNT family')
                      else
                        ShowMessage('win9x family');
----------------------------------------
 while true do begin
 if PeekMessage(Msg,0,0,0,PM_REMOVE) then begin
   TranslateMessage(Msg);
   DispatchMessage(Msg);
   end else WaitMessage;
 end;
-------------------------------------------

Const
  WindowTitle = 'Game Window'; // define the game's window name ;
  Address1 = $4ab3485f;      // define your address to poke   ;
  PokeValue1 = $32;          // define what value to write    ;
  NumberOfBytes1 = 1;        // define how many bytes to write
  Address2 = $4ab3485c;
  PokeValue2 = $11;
  NumberOfBytes2 = 3;


implementation

{$R *.dfm}                   // rescource file (do not change) ;

procedure TForm1.Button1Click(Sender: TObject); // when button is clicked ... ;
Var
 WindowName : integer;
  ProcessId : integer;
  ThreadId : integer;     // defining variable's types  ;
  buf : PChar;
  HandleWindow : Integer;
  write : cardinal ;
begin
 WindowName := FindWindow(nil,WindowTitle);
     If WindowName = 0 then  // check if the game is running;
          	MessageDlg('The game must be running in the background. Run it now, and then try again.', mtwarning,[mbOK],0);
  ThreadId := GetWindowThreadProcessId(WindowName,@ProcessId);
  HandleWindow := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId);
  GetMem(buf,1);
  buf^ := Chr(PokeValue1);
  WriteProcessMemory(HandleWindow,ptr(Address1),buf,NumberOfBytes1,write);
  FreeMem(buf);
  closehandle(HandleWindow);
end;
---------------------------------------------------------------
  public
    procedure WMHotKey(var Msg : TWMHotKey); message WM_HOTKEY;
    { Public declarations }
  end;

  const
   F3_HotKey = 10003;
   F4_HotKey = 10004;
   F5_HotKey = 10005;
   F6_HotKey = 10006;

procedure TForm1.FormCreate(Sender: TObject);
begin
   RegisterHotKey(Handle,F3_HotKey,0,VK_F3);
   RegisterHotKey(Handle,F4_HotKey,0,VK_F4);
   RegisterHotKey(Handle,F5_HotKey,0,VK_F5);
   RegisterHotKey(Handle,F6_HotKey,0,VK_F6);
end;

procedure TForm1.WMHotKey(var Msg: TWMHotKey);
begin
 case MSG.HotKey of
    F3_HotKey: ShowMessage('F3!');
    F4_HotKey: ShowMessage('F4!');
    F5_HotKey: ShowMessage('F5!');
    F6_HotKey: ShowMessage('F6!');
   End;
End;
----------------------------------------------------------------
Var
 F: TSearchRec;
begin
 if FindFirst('c:\mp3\*.mp3', faAnyFile, F) = 0 then
  repeat
    Form1.ListBox1.items.add(F.Name);
  until FindNext(F) <> 0;
End;
-------------------------------------------------------------------

    Source: geocities.com/tcjdelphi