Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WSH script to create a shortcut doesn't work on Vista
Message
De
16/04/2007 12:20:52
Emerson Reed
Folhamatic Tecnologia Em Sistemas
Americana - São Paulo, Brésil
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
01215705
Message ID:
01216305
Vues:
27
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform