Solved

Autoarrange of Desktop Icons

Posted on 2001-06-18
5
768 Views
Last Modified: 2008-02-26
Anyone knows how to turn off the destop 'Auto Arrange' for the icons?
I tried this but didn't succeed:
The Listview handle should be correct as the arrange to the left works.

function GetDesktopLVHandle: THandle;
const
 LV_CLASS = 'SysListView32';
var
  S: String;
begin
  Result := FindWindow('ProgMan', nil);
  Result := GetWindow(Result, GW_CHILD);
  Result := GetWindow(Result, GW_CHILD);
  SetLength(S, length(LV_CLASS)+1);
  GetClassName(Result, PChar(S), length(LV_CLASS)+1);
  if PChar(S) <>  LV_CLASS then Result := 0;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  ws : LongWord;
  lvHandle : THandle;
begin
  lvHandle := GetDesktopLVHandle;
  ws := GetWindowLong(lvHandle, GWL_STYLE);
  ws := ws or LVS_AUTOARRANGE;
  SetWindowLong(lvHandle, GWL_STYLE, ws);
end;

0
Comment
Question by:Tasomia
  • 2
5 Comments
 
LVL 20

Accepted Solution

by:
Madshi earned 50 total points
ID: 6205293
You can't all SetWindowLong for windows that don't belong to your process. So the solution is this: Put the SetWindowLong code into a little dll and make the explorer load this dll (e.g. by misusing SetWindowsHookEx(WH_GETMESSAGE)). Then it will work fine...

Regards, Madshi.
0
 
LVL 2

Author Comment

by:Tasomia
ID: 7048773
Can you show me some code?
0
 
LVL 20

Expert Comment

by:Madshi
ID: 7048947
Wow, one year later...

I'm sorry, I don't have the time to write code for this.
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 8684136

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept Madshi's comment as answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 

Thank you,
Russell

EE Cleanup Volunteer
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question