Use FindWindow function and use LVM_ARRANGE message. Don't forget to add CommCtrl in the uses capter.
uses CommCtrl; ... procedure TForm1.Button1Click(Sender: TObject); var Res: THandle; begin Res:=FindWindow('ProgMan', nil); Res:=GetWindow(Res, GW_CHILD); Res:=GetWindow(Res, GW_CHILD); SendMessage(Res, LVM_ARRANGE, LVA_SNAPTOGRID, 0); end;