Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving shortcuts on desktop with VFP9 1

Status
Not open for further replies.

dkean4

Programmer
Feb 15, 2015
282
US
Does anyone have a sample code of how to move Shortcuts on the Desktop?

I found this code for creating new Shortcuts,

Code:
WSHShell = CreateObject("WScript.Shell")
 
* Read desktop path using WshSpecialFolders object
loDesktopPath= WSHShell.SpecialFolders("[COLOR=#EF2929]Desktop[/color]")

* 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.



Optionz_lksj1v.jpg


Any suggestion would be very appreciated!



Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
If the user has Windows set to its default (auto-arrange) you shouldn't mess with it.

Desktop arrangement belongs to the user.
 
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 [Smile]ing

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.
 
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!!!
 
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 [Smile]ing

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.
 
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
 
I am a clever chap.
I am not Harry Potter.

Regards

Griff
Keep [Smile]ing

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.
 
Do like I do: I have zero icons on my desktop, none. No need for icons with Win10 + SlickRun.
 
Griff,

But it is nice to have a fan! Right?

Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
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
 
Indeed and thank you

Regards

Griff
Keep [Smile]ing

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.
 
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.
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top