PDA

View Full Version : INSTALLDIR issue



kajal_shah16
09-08-2004, 04:29 PM
With InstallShield Express X

1. Organize your setup > General Information > I have set INSTALLDIR to [ProgramFilesFolder]Microsoft Office\Templates

2. Then in custom action
Custom Action During Installation > After Customer Information > GetTemplateFolderLoction

3. My custom action returns value something like this C:\Document and Settings\UserName\Application Data\Microsoft\Templates.

4. The dialog box during installation shows correct path as in step 3 above. But installer actually installed all files in [ProgramFilesFolder]Microsoft Office\Templates as shown in step 1, why?

Mike Marino
09-09-2004, 05:59 PM
If I had to guess, I would say you are setting INSTALLDIR with Property property and not the TargetPath property. That is if you are using VBSCRIPT session object.

kajal_shah16
09-10-2004, 03:26 PM
Here is my code of custom action

__declspec(dllexport)
char WINAPI TemplatesExt(HWND hWnd, LPSTR pszSrc, LPSTR pszSupport,
LPSTR pszInstall, LPSTR pszReserve)
{
char szTmp[256];
char szMsgBoxMessage[2*_MAX_PATH];

if(LoadTemplatesFolder(szTmp, sizeof(szTmp)))
{
strcpy(pszInstall, szTmp);
}
else
{
; // Do nothing - We will return with value 1 and InstallShield will continue
// install into default folder set in Installer script
}

return 1; // InstallShield continues only if it gets return = 1 otherwise it quits
}

I am calling it "after customer Information dialog" I do not see any other option to set in InstallShield Express X

Mike Marino
09-13-2004, 07:55 PM
You want to use Function Signature set to "New" not "Classic" . Classic Custom Actions cannot set properties like INSTALLDIR, they are basically Read Only.

Here is some sample Code:

#include "msi.h"
#include "msiQuery.h"

UINT __stdcall Action(MSIHANDLE hInstall)
{
TCHAR szbuffer[MAX_PATH] = {0};
DWORD dWord = MAX_PATH;
MsiGetTargetPath(hInstall, TEXT("INSTALLDIR"), szbuffer, &dWord);
MessageBox(0, szbuffer,TEXT("Showing Installation Location"), MB_OK);
// Modify szbuffer
MsiSetTargetPath(hInstall, TEXT("INSTALLDIR"), szbuffer);
return 1;
}

kajal_shah16
09-13-2004, 11:42 PM
Thanks... It worked