Friday, November 22, 2019

IE inside the Form

Unlike with placing internet explorer browser inside our form via Internet Explorer Shell, this is similar to my other blogs of opening the URL directly on a browser like Chrome and Firefox, capturing its window handle, adjusting window style and placing said browser inside of our form.  This time though, it is by using Internet Explorer as the Browser as we have more handles on it.  Not to mention that IE automatically comes with the OS unlike the other browsers which our clients may not choose to have.

So why am I suggesting to do it this way when we can do the same via Shell.Explorer?   Well, it is not quite the same actually.  Shell.Explorer for one adjusts the site to the basic design without CSS applied.  So the display you will see will not be entirely the same when you open it via a browser.  Sometimes also, JavaScript hampers its execution especially with the new OS now in place.  Now, opening the browser itself will ensure that it has the latest features, based on your browser version. 

The reason I created this entry is because there is a question inside Foxite forum that if we do it this way, then how to position IE inside our form at specific coordinates and  not as a full screen filling the entire form?   So I am showing here how we can achieve that, as a guide.  Improve it further based on your needs.  Codes follow:

Thursday, September 12, 2019

Enumerating Path Links and Installed Apps

A friend requested for my assistance as they were recently hit by a ransomware so he wants to reformat all machines.  But before that, since there are around 60 machines to be reformatted, he wants to create a list of the path location of the shortcuts on its Desktop plus a list of all installed apps; so he can bring those back properly after reformatting and re-installation. 

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