Solved

Autoarrange of Desktop Icons

Posted on 2001-06-18
5
757 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
Comment Utility
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
Comment Utility
Can you show me some code?
0
 
LVL 20

Expert Comment

by:Madshi
Comment Utility
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
Comment Utility

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now