Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WSH script to create a shortcut doesn't work on Vista
Message
From
16/04/2007 12:20:52
Emerson Reed
Folhamatic Tecnologia Em Sistemas
Americana - São Paulo, Brazil
 
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01215705
Message ID:
01216305
Views:
25
If someone is interested in make some tests, here is the code:
Declare IsUserAnAdmin In Shell32
If IsUserAnAdmin()
	Messagebox("It's an Administrator user."+Chr(13)+Chr(10)+;
		"Let's try to create a shortcut...",64)
	Local loWSH As WScript.Shell, lcStartupDir, loLnk
	loWSH = Createobject("WScript.Shell")
	lcStartupDir = loWSH.SpecialFolders("AllUsersStartup")
	loLnk = loWSH.CreateShortcut(Addbs(lcStartupDir) + "Test.lnk")
	loLnk.TargetPath = "C:\MyFolder\MyExe.exe"
	loLnk.WorkingDirectory = "C:\MyFolder"
	Store Null To loLnk, loWSH
Else
	Messagebox("Isn't an Administrator user!",16)
Endif
Clear Dlls IsUserAnAdmin
Return
All you neeed to do is create a project, place the code above in a prg (change TargetPath and WorkingDirectory properties), set it as main and generate an Install.Exe.
Emerson Santon Reed
"One Developer CAN Make a Difference. A community CAN make a future." - Craig Boyd
Previous
Reply
Map
View

Click here to load this message in the networking platform