4.6.1

Table Of Contents
VMware, Inc. 119
Chapter 9 Creating ThinApp Scripts
4Addtheinformationinthesystemregistry.
RegEditPid = ExecuteExternalProcess("regedit /s " & chr(34) & RegFileName & chr(34))
WaitForProcess RegEditPid, 0
Waituntiltheprocessiscomplete.
5Cleantheenvironment.
fso.DeleteFile(RegFileName)
End Function
API Functions
YoucanuseAPIfunctionsthatinstructThinApptocompleteoperationssuchasloadDLLsasvirtualDLLS,
convertpathsfrommacroformattosystemformat,andruncommandsinsideofthevirtualenvironment.
AddForcedVirtualLoadPath
TheAddForcedVirtualLoadPath(Path)functioninstructsThinApptoloadallDLLsfromthespecifiedpath
asvirtualDLLseveniftheyarenotlocatedinthepackage.
UsethisfunctioniftheapplicationneedstoloadexternalDLLsthatdependonDLLslocatedinsidethe
package.
YoucanusetheForcedVirtualLoadPathsparameterintheP
ackage.inifiletoachievethesameresultas
thisAPIfunction.See“ForcedVirtualLoadPaths”onpage 75.
Parameters
Path
[in]ThefilenameorpathforDLLstoloadasvirtual.
Examples
YoucanloadanyDLLlocatedinthesamedirectoryastheexecutablefileasavirtualDLL.
Origin = GetEnvironmentVariable("TS_ORIGIN")
TS_ORIGINisthepathfromwhichtheexecutablefileisrunning.
YoucandeletethefilenamefromTS_ORIGINbyfindingthelastbackslashandremovingallofthecharacters
thatfollowit.
LastSlash = InStrRev(Origin, "\")
SourcePath = Left(Origin, LastSlash)
YoucaninstructThinApptoloadallDLLsinthesameorlowerdirectoryfromwherethesourceexecutable
fileresides.
AddForcedVirtualLoadPath(SourcePath)
ThisprocessenablesyoutodropadditionalfilesintheSourcePathtreeandhavethemresolveimport
operationsagainstvirtualDLLs.
ExitProcess
TheExitProcessExitCodefunctionquitsthecurrentprocessandsetsthespecifiederrorcode.
Parameters
ExitCode
[in]Theerrorcodetoset.Thisinformationmightbeavailabletoaparentprocess.Avalueof0indicatesno
error.