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
Solved

Turn auto arrange for icons on desktop off in program.

Posted on 1998-05-16
13
335 Views
Last Modified: 2013-12-03
Anyone know how to turn off the auto arrange for icons on desktop inside a program? any Win32 API for that? please let me know or show me the method if you know how thanks.
0
Comment
Question by:waimun
  • 8
  • 4
13 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1402254
The way I would do it is to use

  HWND desktop = GetDesktopWindow();
  SetWindowLong(desktop, GWL_STYLE, GetWindowLong(desktop, GWL_STYLE) & ~LVS_AUTOARRANGE);


0
 

Author Comment

by:waimun
ID: 1402255
Hi thui,
Have you tried the solution you gave? In fact I tried it before, and even use FindWindow for 'progman' and get its child window to locate the desktop HWND. All these fails, I believed that this got to do with the reason that this is not a normal Listview class, it is a desktop and hence the solution given above of similar type will fail... May be I have did the wrong thing, you go and try and if yours work, send your code to me at email: waimun@cheerful.com and I will give you an 'A' for it if it works. Anyway thanks. I believe, there is something got to do with SysListView32 class, and that desktop is from another process...tricky huh!
0
 

Author Comment

by:waimun
ID: 1402256
I'm raising the point for better solution...
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:waimun
ID: 1402257
Adjusted points to 150
0
 

Author Comment

by:waimun
ID: 1402258
Adjusted points to 200
0
 
LVL 2

Accepted Solution

by:
connex earned 200 total points
ID: 1402259

Ok.. this has drawn my attention and I played around a bit
today. I found a way to actually change the setting but still loking for a way to change it in the context menu as well.
Here's what I got so far:

CWnd *dsk = (CWnd *)FindWindow("Progman","Program Manager");
CWnd *dsk1 = (CWnd *)dsk->GetWindow(GW_CHILD);
CWnd *ExpList = (CWnd *)dsk1->GetWindow(GW_CHILD);
ExpList -> ModifyStyle(LVS_AUTOARRANGE,0,0);

This changes the setting, you can check it with spy++, but
does not modify the context menu until restart.
I'm working on that too, but it might turn out to use some bad messing around.

0
 

Author Comment

by:waimun
ID: 1402260
Hi connex, I've tried your solution, but it some how fails to work...I'm not sure whats went wrong. I've tried using ModifyStyle() and also SetWindowLong, and even tried using PostMessage but all fails. May be you can send me the code and let me try out. Email: waimun@cheerful.com. If it works, I'll definitely give you 'A'. When trying your solution, SPY++ did not indicate the changes as you claimed, may be something went wrong in my code. By the way, what I really want is tohas the effect immediately, i.e. when the program changes the auto arrange option of the desktop, I should expect that I can move the icon anywhere I like on the desktop without being auto arrange back. I know that this is possible using window hooks and of course a DLL file. But, I hope to be able to do it without the hassle of DLL file. Thanks!
0
 
LVL 2

Expert Comment

by:connex
ID: 1402261
The effect is immediately. The third parameter 0 indicates that the explorer shall
refresh the display. I will mail you my sample code on Monday when i'm back in my office.


0
 

Author Comment

by:waimun
ID: 1402262
Thanks a lot connex. By the way, out of curiosity, there is a computer based vision group out there call Connex in USA, that provide vision supports. Are u anyway related to them?
0
 
LVL 2

Expert Comment

by:connex
ID: 1402263
Ok just sent the source code.
No i'm not related to them .) There are several companies around
with the name connex. But I took the name simply from
my desk :-) It's the brandname of my phone.

0
 

Author Comment

by:waimun
ID: 1402264
thanks connex...evaluating...give u reply in 1 day time
0
 

Author Comment

by:waimun
ID: 1402265
hi connex, I have evaluated your source code but it didn't work out. Don't know what is wrong. May be u are using NT, while i'm using Window 95. I think this makes the differences. Even Spy++ doesn't show any thing. I'm very sure that the ExpList is a SysListView32 class as i used GetWindowClass to counter check. But nothing works out. Anyway for your kind help and hard work I will still give u the 'A'. Thanks! By the way, may be u send the executable file for me to test? Thanks!!!
P.S.-Maybe Window 95 doesn't allow the changes to happen... In future if you know the solution, or something regarding this, do drop me an email and I will be very much appreciated! Thanks...
0
 
LVL 2

Expert Comment

by:connex
ID: 1402266
hmm i will check this tomorrow on my W95 notebook. maybe i can lighten this a bit .)

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

790 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