Solved

Autoarrange of Desktop Icons

Posted on 2001-06-18
5
779 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month5 days, 13 hours left to enroll

627 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