Load Image File in Canvas in the correct Program Directory in Windows

I recently created file not found bug for my 32 bit Windows Build by creating path for 64 bit Program Files directory when it was suppose to 32 (x86).
I just learned that the installer remembers your program directory “C:\Program Files\My Program” in the FolderItem Object.

I want to rewrite GetFolderItem the so it automatically knows my program directory. because 64 Bit Windows OS have both Directories
Did I write the F = GetFolderItem line of code (bottom) correctly to find to the file path (Directories Below) or is there a better way?

Full Path to Image 64 Bit "C:\Program Files\My Program\Graphics\oteGraphics\OvlBluLgNote\OvlBluLg_1.bmp

Full Path to Image 32 Bit "C:\Program Files (x86)\My Program\Graphics\oteGraphics\OvlBluLgNote\OvlBluLg_1.bmp

Dim strImgFolder, strImgFile As String

strImgFolder = “\OvlBluLgNote”

strImgFile = “OvlBluLg_1.bmp”

Dim f As New FolderItem

f =GetFolderItem("") .Parent ("\Graphics\oteGraphics") .Child (strImgFolder).Child (strImgFile).OpenAsPicture

cvsStr(intfret).BackDrop = Picture.Open(F)

For 64 bit install path you should use SpecialFolder.Applications.NativePath. That gives you “C:\Program Files (x86)”. Your line <f =GetFolderItem("") .Parent ("\Graphics\oteGraphics") .Child (strImgFolder).Child (strImgFile).OpenAsPicture> ist not correct. You must uses this:
f =GetFolderItem("") .Parent.child(“Graphics”).child(“NoteGraphics”).Child(strImgFolder).Child(strImgFile).OpenAsPicture

More simply, GetFolderItem("") returns a folder item pointing to the directory your application is in. Or even better GetFolderItem("Graphics") returns a folder item pointing to the Graphics directory in the folder your application is installed in. (Assuming that “My Program” is the folder that your app is installed in in your example above.)

strImgFolder = "OvlBluLgNote"    // no slashes needed
strImgFile = "OvlBluLg_1.bmp"
Dim f as FolderItem    // no need for New FolderItem, as we're just going to throw it away anyway
f = GetFolderItem("Graphics").Child(strImgFolder).Child(strImgFile)   // no OpenAsPicture

Hi Tim
Thanks again for your help. Can it find the directory all the way up to the Note Graphic folder written as below? If so that is really cool it saves writing a long path in your codes. It seems that the shorter the code the better.

f = GetFolderItem(“Note Graphics”).Child(strImgFolder).Child(strImgFile)

Yes, assuming Note Graphics is in the same folder as your .exe file.

Thanks again Tim your help has been Awsome