搞定~~~
在桌面点击鼠标右键,去掉“排列图标”里的“自动排列”前面的选中号~~~
只要取得桌面图标的句柄,然后就可以为所欲为了~~~
下面的例子将桌面的图标排列为一个圆形,至于移动你应该会做了吧?呵呵~~
记得添加CommCtrl单元.
function GetDesktopHand: THandle;
begin
; Result:=FindWindow('progman',nil);
; Result:=GetWindow(Result,GW_Child);
; Result:=GetWindow(Result,GW_Child);
end;
procedure Circle(r: integer);
var
; i, Count, CenterX, CenterY, TempR :integer;
; Hand: THandle;
; Radian: double;
; TempRect: TRect;
; DesktopHeight,DesktopWidth :integer;
; X, Y : Word;
begin
; Hand:=GetDesktopHand;
; SystemParametersInfo(SPI_GetWorkArea,0,@TempRect,0);
; DesktopWidth:=TempRect.Right - TempRect.Left;
; DesktopHeight:= TempRect.Bottom - TempRect.Top;
; CenterX:=DesktopWidth div 2;
; CenterY:=DesktopHeight div 2;
; if CenterX>CenterY then
; ; TempR:=CenterY
; else
; ; TempR:=CenterX;
; if r>TempR then r:=TempR;
; Count:=Listview_GetItemCount(Hand);
; Radian:=2*3.14159/Count;
; for i:=0 to Count-1 do
; begin
; ; X:=Integer(CenterX+Trunc(r*Sin(i*Radian)));
; ; Y:=Integer(CenterY+Trunc(r*Cos(i*Radian)));
; ; SendMessage(Hand,LVM_SetItemPosition,i,MakeLparam(X, y));
; end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
; Circle(150);
end;