Copy and paste the following define statements at the beginning of your setup. RUL file. also, make sure you copy and paste the prototype for the shgetfolderpatha () Windows API. this Windows API retrieves the path
To the locations you want.
Use shgetfolderpatha ()
Msdn
SHGetKnownFolderPath http://msdn.microsoft.com/en-us/library/windows/desktop/bb762188(v=vs.85).aspx
// Define Microsoft CSIDL constants
// Define the ID of the Environment Variable
// See msdn knownfolderid
//http://msdn.microsoft.com/en-us/library/windows/desktop/dd378457(v=vs.85).aspx
#define CSIDL_FAVORITES 0x0006 //%USERPROFILE%\Favorites
#define CSIDL_COMMON_FAVORITES 0x001f //%USERPROFILE%\Favorites
// Prototype SHGetFolderPathA in SHFolder.dll
// Load shfolder. dll so that you can use shgetfolderpatha ().
prototype NUMBER SHFolder.SHGetFolderPathA(HWND, NUMBER, NUMBER, NUMBER, BYREF STRING);
The following example code shows you how to call the above win API function.
// Code
function OnBegin()
number nFolder; // CSIDL value you want to use
string szPath; // Will contain path returned from API
number nResult; // Return value from API
begin
try
// Code to get user’s favorites directory
nFolder=CSIDL_FAVORITES;
szPath="";
nResult=SHFolder.SHGetFolderPathA(NULL, nFolder, NULL, 0, szPath);
if (nResult=0) then
MessageBox("CSIDL_FAVORITES= "+szPath,0);
else
SprintfBox(SEVERE, "CSIDL_FAVORITES", "Failed(%d): %s", nResult, FormatMessage(nResult));
endif;
// Code to get common favorites directory
nFolder=CSIDL_COMMON_FAVORITES;
szPath="";
nResult=SHFolder.SHGetFolderPathA(NULL, nFolder, NULL, 0, szPath);
if (nResult=0) then MessageBox("CSIDL_COMMON_FAVORITES= "+szPath,0);
else
SprintfBox(SEVERE, "CSIDL_COMMON_FAVORITES", "Failed(%d): %s", nResult, FormatMessage(nResult));
endif;
catch
MessageBox("Unsupported OS.",0);
endcatch;
end;