Skip to Content
Former Member
Mar 26, 2015 at 06:21 PM

GetFileOpenName default location is different for short filename and long filenames


We use GetFileOpenName PB built-in function to find PDF files. The initdir variable passed to this function was a short file name (ex. C:\PROGRA~1\TEMP). The behavior of the default starting folder was as expected and as described with the hierarchy in windows 7. The hierarchy being last known open/save folder location is "saved" (do not know where) and used if one is found else the application uses C:\PROGRA~1\TEMP as default location. The last save/open information is retained even after exiting the application.

Our network staff was dropping the support for short file names and we changed the filenames to NTFS. So when calling the GetFileOpenName, we send "C:\Program Files\TEMP" value to the initdir variable. Now the last known open/save folder location is not being defaulted to anymore.

Is there a way to find this "saved" location? Why would sending a short file name work and not a NTFS name?

Got the application to function the same way by sending the GetCurrentDirectory() as the initdir. But this is limited to only that session of the application. Once the user exits the application the last open save location is gone with it.

Tried searching the REGISTRY for the location (by string searching for last location). No luck. If this is saved by PB, what is the registry key? If not a registry entry then where can this be found?

I know there are fileIO windows API calls that give better control. However, the built in PB function retains the last open/save location even after you have exited the application. Short of saving this information off somewhere (DB or user profile), would like to get at this information if it is accessible.

Environments: PB 12.5.1 build 4595, OS - windows 7.

Any help would be greatly appreciated. Thank you. SM.