Solved

Turn auto arrange for icons on desktop off in program.

Posted on 1998-05-16
13
327 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
Comment Utility
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
Comment Utility
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
Comment Utility
I'm raising the point for better solution...
0
 

Author Comment

by:waimun
Comment Utility
Adjusted points to 150
0
 

Author Comment

by:waimun
Comment Utility
Adjusted points to 200
0
 
LVL 2

Accepted Solution

by:
connex earned 200 total points
Comment Utility

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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:waimun
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
thanks connex...evaluating...give u reply in 1 day time
0
 

Author Comment

by:waimun
Comment Utility
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
Comment Utility
hmm i will check this tomorrow on my W95 notebook. maybe i can lighten this a bit .)

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

728 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

8 Experts available now in Live!

Get 1:1 Help Now