PowerBuilder – Finding special folders – FDCC Compliance

Posted on Tuesday, February 14th, 2012 at 6:03 pm in

Here is a link to an article by Bruce Armstrong (since broken) relating to new functionality in PB11.5.  The article specifically deals with FDCC (Federal Desktop Core Configuration)  Compliance in PB apps and specifically the SHGetFolderPath Windows API function.  Although this information has been available for awhile, it’s worth noting again.

Usage Notes:

function ulong SHGetFolderPath(ulong hwndOwner, long nFolder, &
ulong hToken, long dwFlags, Ref string pszPath) library 'shell32.dll' &
alias For "SHGetFolderPathA;Ansi"

or

Function long SHGetFolderPath ( long hwndOwner, long nFolder, &
long hToken, long dwFlags, Ref string pszPath ) Library "shell32.dll" &
alias For "SHGetFolderPathW"

Constant Long CSIDL_PERSONAL = 5 // current user My Documents
Constant Long CSIDL_APPDATA = 26 // current user Application Data
Constant Long CSIDL_LOCAL_APPDATA = 28 // local settings Application Data
Constant Long CSIDL_COMMON_DOCUMENTS = 46 // all users My Documents
Constant Long CSIDL_COMMON_APPDATA = 35 // all users Application Data
string ls_path
ulong lul_handle, lul_rc, lul_hToken

ls_path = Space(256)
lul_handle = Handle(This)
SetNull(lul_hToken)
lul_rc = SHGetFolderPath(lul_handle, CSIDL_APPDATA, lul_hToken, 0, ls_path)

RETURN ls_path // path

Top