Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Turn auto arrange for icons on desktop off in program.

Posted on 1998-05-16
13
Medium Priority
?
347 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

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 800 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and 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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

971 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