×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Moving shortcuts on desktop with VFP9

Moving shortcuts on desktop with VFP9

Moving shortcuts on desktop with VFP9

(OP)
Does anyone have a sample code of how to move Shortcuts on the Desktop?

I found this code for creating new Shortcuts,

CODE --> VFP

WSHShell = CreateObject("WScript.Shell")
 
* Read desktop path using WshSpecialFolders object
loDesktopPath= WSHShell.SpecialFolders("Desktop")

* Create a shortcut object on the desktop
loMyShortcut = WSHShell.CreateShortcut(loDesktopPath  + '\MyShortCutName.lnk')   && the '\ before than shortcut name is important

* Set shortcut object properties and save it
loMyShortcut.TargetPath = 'c:\myAppDir\myApp.exe'
loMyShortcut.WorkingDirectory = 'c:\myAppDir\' 
loMyShortcut.WindowStyle = 4
loMyShortcut.IconLocation = 'c:\myAppDir\myApp.exe' + ',0'
loMyShortcut.Save 

....but inspecting the feature list of the object loMyShortcut I do not see a way to move the icon on the DESKTOP screen's X, Y space.





Any suggestion would be very appreciated!



Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci

RE: Moving shortcuts on desktop with VFP9

If the user has Windows set to its default (auto-arrange) you shouldn't mess with it.

Desktop arrangement belongs to the user.

RE: Moving shortcuts on desktop with VFP9

The most basic arrangement you could organise is using the ASCII sort to move the shortcut to the first/last positions on the desktop - prefix the name of the shortcut with a dollar sign will make it near the beginning (top left most likely) or an underscore to make it the last item (bottom right most likely).

Bear in mind what Dan says above, and also that some 'special' icons are likely to take precedence anyway.

loMyShortcut = WSHShell.CreateShortcut(loDesktopPath + '\$MyShortCutName.lnk')
loMyShortcut = WSHShell.CreateShortcut(loDesktopPath + '\_MyShortCutName.lnk')

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: Moving shortcuts on desktop with VFP9

If a company sold me a program which re-organized my desktop, I would sue that company for all it was worth! My desktop is MY desktop!!!

RE: Moving shortcuts on desktop with VFP9

Bit extreme Tore, but your point is well made.

A little like some installs changing your internet settings/home page and add-ons.

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: Moving shortcuts on desktop with VFP9

(OP)
No Auto-Arrange... Mine float freely on the desktop and I group them as I like. I use a 4K monitor for my primary screen and I have lots of room on it. So, for me, rather than click on the start and pilfer through the lists I see all my most common icons.shortcuts and it is quite handy. No background image too, so it is easy to identify one among the myriad icons...

The thing is that some folks have figured out how to move the icons on the desktop and offer software like IconShepherd, but they make sure that it wrecks the icons from time to time in order to force the user to buy another copy. That makes me mad... I want to gain control over the icons.

I know that I can use the mouse move functions in VFP to pick the icons and move them to another location with code, but it sure would be nice to know where the X,Y position is stored so I can go there and play with it. I assume it is in the registry. But I was not able to figure out where. Any clue would be a good start...

As regards the advice not to mess with the positions, sorry guys, I have everything organized in my head and when an icon moves away it is like somebody moving my office into another foreign city just to make my life difficult.

I was hoping that Griff had some trick up his sleeve ...

If anyone gets some clue, it would be so appreciated...

Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci

RE: Moving shortcuts on desktop with VFP9

I am a clever chap.
I am not Harry Potter.

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: Moving shortcuts on desktop with VFP9

Do like I do: I have zero icons on my desktop, none. No need for icons with Win10 + SlickRun.

RE: Moving shortcuts on desktop with VFP9

(OP)
Griff,

But it is nice to have a fan! Right?

Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci

RE: Moving shortcuts on desktop with VFP9

(OP)
Tore Bleken,

I will look into SlickRun... looked at it and it seems interesting. What is it that you like among its features which helps you the most?

Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci

RE: Moving shortcuts on desktop with VFP9

Indeed and thank you

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: Moving shortcuts on desktop with VFP9

Regarding SlickRun, I use it to start most of my programs. Pretty much like people use desktop shortcut, but without cluttering the screen. Whenever I want to run a program, I press Win+N and type parts of the name I have given the "shortcut", called Magic Word in SlickRun. I use the same solution to open my favorite folders and favorite URLs.

RE: Moving shortcuts on desktop with VFP9

(OP)
Tore Bleken,

I like that, seems good. I am thinking of doing it another way. I already have a website which is geared to respond to my voice using Google's Speech Recognition engine and I built a VFP module which can pick up the text from the speech, which it can use to trigger programs, directories etc... You gave me a good idea. It would be nice to have a clear screen... Except that seeing the icons sort of reminds you what you own or what is available to you. I have so many programs that I cannot remember them all...

It is always nice talking to you guys. New ideas always popping in from the sky...

Thanks for the inspiration!

Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close