News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

My first program

Started by Jimg, September 15, 2005, 04:13:53 PM

Previous topic - Next topic

Jimg

Hi all.  I started assembly language for window about a year and a half ago, and it's been quite some journey.  My first program, which I thought would be a nice simple one :wink to learn the process, is now at a stage where I need to move on to other things and stop fiddling with it.  That being said, I'm presenting it here for any suggestions and or bug reports.  The program-


         Dip  -  Desktop Icon Positioner  -  by Jim Giordano

  This code and program released to the public domain for any purpose.

  This program allows you to position the icons on your desktop precisely using the keyboard cursor keys or a mouse.

  You may select one or more icons from the listview.  If you click on a direction arrow, you may then move them as a unit one pixel at a time with either the mouse or keyboard.  You may also enter an X or Y coordinate for them, or enter a delta to space them out.
 
  For large movements, you may move the items directly on the desktop as usual, and when you return, the new positions will be updated in the Dip table for fine adjustment.
 
  You may restore the positions of any icons to the position they had when Dip was started.

  You may sort on any column in the listview, for example X or Y to make lining up rows or columns easier.

  You may save many different layouts as desired, for example, one for each screen resolution.
 
  There are no entries made in the registry.  Each copy of Dip is self-contained in it's own folder as desired.
 
 

Attached are the program and complete source code.


Edit 4/14/08:  Changes-
Updated to search for and use the Auto Arrange menu item.
Minimize all other windows while running, restoring them upon completion.
Reset the Align To Grid and Auto Arrange setting in the registry if needed.
Physically move an icon (emulating mouse movements) to lock in desktop changes.
Check for an already running instance and exit if found.

Previous versions downloaded 532 times.


[attachment deleted by admin]

Jimg

p.s.

Many thanks to those who have helped me along the way, especially Antonis Krprianou (WinAsm Studio) when I was first getting started and most everything was a mystery, and Donkey for help getting the desktop listview type data.

drarem


ic2

Jimg I had know idea that it would be a member that this Forum.  I was just thinking that who ever wrote it must be an assembler guru.  The kind of person from the old dos days setting out some 32 bit programs.  Can't get stronger than that.

That's a lot of work, a lot of thinking and a heck of a challenge for any first time ASM programmer.  I'm sure most would agree.

Jim Giordano, when i see the name Jimg, I only think of the strLen Speed King.  Now i know.

Anyway, how can I possibly have any questions.  You comment the source code so well that even a newbee could learn how to code heavily in assembler in no time at all and walk away in a week or two with an understanding of it as good myself... and i been around the block a few time.

After i complete my mission I will post any improvements that i can come up with.  I'm sure I'll find a few.  As for now it's a road map to new coding style i never see before.  A lot of that going one around here...   It got all kinds of ways to use PROC.  Styles that i tried that would not work...

I been trying to improve on my application doing something like this since last September.  Than the idea of forcing icons out the way simply became more important for the security of business desktop running my program.  This one line in your entire source was the answer that problem.  I do lots of research  before i try asking.  A thread can get lost in a minute.  Like this ONE.

Totally undocumented as far as i know to date or i simply did not know what about i was reading.  I don't understand c...

"LVM_SETITEMPOSITION wants two words in a DWord"

One Down and One to Go :)

All i got to say is


Great Work!!!
Thanks
and I'm glad it was you

Jimg

In case I gave the wrong impression with my first post, yes this is my first assembly language program for Windows.  But I am indeed an old pre-dos dinosaur :8)   For many years I could just not see the reason to hassle with windows.  Finally after I had to retire, I had enough time to figure it out.  And the Windows part is still the nastiest part for me.  I love assembly programming, I just can't stand hassling the windows api interface.

Jimg

#5
Minor update.  If you used the registry file provided to add Dip to the right-click context menu, it would put the ini file in odd places.  Updated so the ini file is always in the same folder as the .exe file.
If you used the old version, you find do a search for all occurrences of dip.ini and delete the unwanted ones.  Sorry.

jj2007

Impressing, my compliments! Just a small hint: I tried it and got frustrated because nothing moved. Only after a while I had the bright idea to switch off the auto align of my desktop...

Jimg

You should have gotten a message box that says:
"Auto arrange of desktop icons set to true, position changes will not hold. Do you want to disable Auto arrange?"

I'll check it out.

later...   well, I get the message, but the program doesn't disable it properly, so I'll change the comment to say to disable auto arrange manually until I figure it out.

later again...
well, dang it, that used to work.  This was probably before sp2.  I'll work on it.

jj2007

No message at all, Jim, perhaps because I am still with SP1.

thomas_remkus

I also needed to turn off my "Auto Arrange" and also did my "Align to Grid". Then it worked fine.

Just for fun it would have been sort of neat to have all my icons position themselves in a large circle (i'd have to limit the icons to like 10 or something) and have them rotate. That would have been a cool effect for what ... nothing, just cool.

Jimg

Changing autoarrange in code is pretty flakey stuff.  I couldn't find anything at Microsoft.  I'm getting the message, I have no idea why you aren't, but I'll keep looking.  At least the program still works after you turn it off manually. ::)

Anyone else know how to turn the auto arrange off reliably with code?

Jimg

New update in first post.  I've determined the new id of the "Auto Arrange" menu item for the desktop.  It's hardcoded for now, but I'm still searching for a way to determine it at run time in case it changes again.

Jimg

Updated.  I now search the menu for the id of AutoArrange.

jj2207-
  please try this and let me know if it still doesn't detect that you have autoarrange set.
  if so, what os are you using, and is any other alignment set (like arrange to grid, arrange by name, etc.)?

jj2007

Quote from: Jimg on March 27, 2008, 06:11:35 PM
Updated.  I now search the menu for the id of AutoArrange.

jj2207-
  please try this and let me know if it still doesn't detect that you have autoarrange set.
  if so, what os are you using, and is any other alignment set (like arrange to grid, arrange by name, etc.)?

It does detect autoarrange now, so that's fine. However, it does not detect align to grid... which also gives the impression that dip does not do anything, unless the user insists to click 8 times or so.
Sorry  :wink

Jimg

Ok, thanks.  I'll add an align to grid check next.

I have another question.  Was it obvious to you that you could use the cursor keys to move an icon, or did you only think you could do it with mouse click?