Any API or other method set Desktop's AutoArrange = False


Is there any API or other method set Desktop's AutoArrange = False?
if has, could you give a few line of code please?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You have to find the desktop listview's handle like this:

var lv : dword;

lv := FindWindowEx(FindWindowEx(FindWindow('Progman', 'Program Manager'), 0, 'SHELLDLL_DefView', ''), 0, 'SysListView32', '');

Now you have to do

  SetWindowLong(lv, GWL_STYLE, GetWindowLong(lv, GWL_STYLE) and (not LVS_AUTOARRANGE));

The big problem is that SetWindowLong works only for windows that own to your own process. So this all doesn't work from your application. You have to put this in a dll, then you must manage to load your dll into the explorer's process somehow, then execute this code there. *QUITE* difficult...

Another possibility would be to use some APIs to open the context menu of the desktop and execute the appropriate menu item (difficult, too, but not THAT difficult). The main problem here is that you have to find the correct menu item. You can only look for a specific text which would be language dependent. VERY ugly... So the first suggestion would be much better - though more difficult, too.

Regards, Madshi.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
y9yAuthor Commented:
Hi, Madshi:

Thanks for your help.

It seems I ask 2 question for same problem. Try to deal with another process with just a handle of it.

If you do not mind, could you please check the other question? 

Best Regards.
y9yAuthor Commented:

Thanks for your help.

Best Regards;

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.