Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Autoarrange of Desktop Icons

Posted on 2001-06-18
5
Medium Priority
?
787 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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

721 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