Up through Windows XP, if you wanted to get the physical location of certain defined folders (e.g. the users Documents folder), you would use the SHGetFolderPath function in the Windows API. Roland Smith has examples of using that on his Topwiz Software site. That function continues to work in later versions of Windows, although it's basically a wrapper for the SHGetKnownFolderPath function.
SHGetFolderPath uses CSIDL values, whereas SHGetKnownFolderPath uses KnownFolderID GUIDs. One difference is that there are a lot more KnownFolderIDs than there are CSIDLs. That means some of the defined folder locations you may want to get the physical location for can't be accessed through the older SHGetFolderPath method. And that's exactly the situation I ran into.
I needed to find the user's Downloads folder, and there isn't a CSIDL value for that. So, I needed to see how to call the SHGetKnownFolderPath function from PowerBuilder. As with many OLE and Windows API calls, it can save you a lot of time if you can find some Visual Basic code that does what you need to do, and you can convert the syntax. And fortunately, I found some that did this.