Back story
Many of you may or may not have seen the video sales guy vs the web dude but if you haven’t you probably should. Be warned though Not safe for work, there is swearing involved. Well anyways at one point in this video you happen across sales guy’s desktop and you see that his icons are arranged in the shape of a [male genitalia]. The tech who is helping him arranges them alphabetically and when the sale guy complains the tech responds that he cant put it back there is no arrange by [male genitalia]. Well one person on the web thought that there probably should be that feature in windows so he made a call out to windows programmers asking them to write it. As it turns out someone [Taktaal] answered the call, you can see the site in question and download the original source we edited here. Now my co-worker [Mike] and I thought that was a sweet feature to have in windows and we started digging into the source provided with the ArrangeBy[MaleGenitalia] and noticed that it was written really well and would be easy to modify. Well long story short we modified it and came up with ArrangeByImage, which allows you to choose a black and white bitmap image and arrange your icons to match the black parts of the image.
Download
Download ArrangeByImage-1.3 (with source) - Fixed for use with Windows 7.
Archive
Download ArrangeByImage 1.2.1 (with source)
Download Arrange By Image 1.2 (with source)
Download Arrange By Image 1.1 (with source)
Download Arange By Image 1.0 (with source)
Usage
Download the source and program above. Make sure you turn “Align To Grid” off on your desktop (in 1.2 you no longer have to turn Align to Grid off, the app does it for you). Then run the program and browse to any black and white bmp image. Click on arrange by image and enjoy.
When making your own bmp images to feed into the program keep in mind that 1px width black lines work the best.
Further I went ahead and added command line switches so you can run this remotely with say OWExec. Here is the usage listing. The basic command line would be
arrangebyimage -bmp smilly.bmp -silent
or for owexec
owexec -k arrangebyimage.exe -p "-bmp smilly.bmp -silent" -c yourFriendsComputer -nowait
or for one of the built in images (makes it easier to copy)
owexec -k arrangebyimage.exe -p "-smiley -silent" -c yourFriendsComputer -nowait -copy
assuming you have copied the image and the executable over to the target computer
ArrangeByImage v-1.2 USAGE
ArrangeByImage -bmp pathToImage [-icons XX] [ -silent ] [ -help ]
[ -restore ] [ -nosave ]
-bmp the path to the image to be used to arrange the icons
-icons a number, the desired number of icons to sample for
if left blank the number of icons on the desktop
will be used.
-silent program will automatically arrange icons and close
itself displaying nothing to the user.
-nosave by default the current icon layout is saved, this flag
will stop that behavior.
-restore restores a saved version of the layout (undoes what you
have wrought.
-help display this menu
-smiley arange icons in the shape of a smiley (built in image)
-heart arange icons in the shape of a heart (built in image)
-star arange icons in the shape of a star (built in image)
download the current version at officewarfare.net
Screen Shots
3 comments3 Comments so far
Leave a comment


If Auto Arrange is turned on then it won’t work. The icons try to move but just flash. We took your source code and added a function TurnOffAutoArrange that called right after TurnOffSnapToGrid. It will check if autoarrange is turned on and turn it off if necessary. The code can be cleaned up a bit as well.
private void TurnOffAutoArrange(HandleRef desktopReference)
{
// Get the style of the listview
int stylehandle;
stylehandle = GetWindowLong((IntPtr)desktopReference, GWL_STYLE);
// Check to see if auto arrange is on, if so turn off
if ((stylehandle & LVS_AUTOARRANGE) == LVS_AUTOARRANGE)
{
IntPtr hparent = GetParent((IntPtr)desktopReference);
SendMessage(hparent, WM_COMMAND, IDM_TOGGLEAUTOARRANGE, 0);
}
}
This function uses the following signatures:
[DllImport("user32")]
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32")]
public static extern IntPtr GetParent(IntPtr hWnd);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam);
and the following constants:
const int LVS_AUTOARRANGE = 0×100;
const int IDM_TOGGLEAUTOARRANGE = 0×7051;
const int WM_COMMAND = 0×111;
const int GWL_STYLE = (-16);
pls, i like this software but is difficult to download. i have been trying to download it since 11am till now 8.30pm, couldn’t do it. it always say error in icon arrangement. my laptop is HP pavilion 3000. pls help me. i like the software so much…….bye hope to hear from you soon
Howdy samuel, I would love to try to help you get ArrangeByImage working. That error your getting if a bit of a generic one it happens when the program is attempting to get details about the desktop, size and icon count as well as when it is trying to actually move icons around. It is entirely possible that you need to be local admin for some of these functions so I would check that. Beyond that I didnt actually write that portion of the code so perhaps folling the link back to the site that I got the code from originally mide provide you some more clues.