Solved

Turn auto arrange for icons on desktop off in program.

Posted on 1998-05-16
13
342 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
[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
  • 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SAPE.heur.AE935 Visual Studio 3 74
Need to impress with my knowledge of .NET 5 104
VIDEO DATASOURCE Control Resize issue 2 64
Need a simple RegEx to search for two words 27 127
This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
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 an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

752 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