Anyway, here is what I am able to come up with based on his request and desire, in a simplified way. I will add this here in my blogs as this may be useful for others too. You may adjust it further to suit your needs.
Getting paths of shortcut items (.lnk) as well as enumerating installed Apps
Local loShell, loReg, lcFolder, loFolder, lcUnit, lnLoop, loFile, lcFile, loLink, lcKey, lcApp
Create Cursor LinksNApps (xUnit c(20), xType c(4), Link c(40), xPath c(200))
* Get Links
lcFolder = Getenv("USERPROFILE")+'\Desktop\'
loShell = Createobject("Shell.Application")
loFolder = loShell.Namespace(m.lcFolder)
lcUnit = Getenv("COMPUTERNAME")
Set Default To (m.lcFolder)
For lnLoop = 1 To Adir(aLink,m.lcFolder+'*.lnk')
lcLink = aLink[m.lnLoop,1]
loFile = loFolder.ParseName(m.lcLink)
loLink = loFile.GetLink
Insert Into LinksNApps Values (m.lcUnit,'Link', m.lcLink, loLink.Path)
Endfor
* Get installed apps
#Define HKLM 0x80000002
Set Procedure To Locfile(Home(2)+"classes\registry.prg")
Dimension akeys(1)
loReg = Createobject('REGISTRY')
lcKey ='SOFTWARE\WOW6432Node'
loReg.OpenKey(lcKey,HKLM,.F.)
loReg.EnumKeys(@akeys)
For lnLoop = 1 To Alen(akeys)
lcApp = akeys(1,m.lnLoop)
If !Inlist(m.lcApp,'Classes','Clients','Policies','RegisteredApplications') And Left(m.lcApp,1) <> '{'
Insert Into LinksNApps Values (m.lcUnit, 'App',akeys(1,m.lnLoop),'')
Endif
Next
Go Top
Browse NORMAL
Yun,
ReplyDeleteThis is very cool. Tanks for shairng!
Koen