Solved

Autoarrange of Desktop Icons

Posted on 2001-06-18
5
763 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

821 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