Can I see how you have your .wxs file setup to call this?

On 1/5/07, Lionel Pinkhard <[EMAIL PROTECTED]> wrote:

 #include "Install.h"

TCHAR *GetPath(MSIHANDLE hInstall, TCHAR *szFolder)
{
 TCHAR* szPath = NULL;
    DWORD cchPath = 0;
    UINT uiStat =  MsiGetProperty(hInstall, szFolder, TEXT(""), &cchPath);
    if (uiStat == ERROR_MORE_DATA)
    {
        ++cchPath;
        szPath = new TCHAR[cchPath];
        if (szPath)
        {
            uiStat = MsiGetProperty(hInstall, szFolder, szPath, &cchPath);
        }
    }
    if (uiStat != ERROR_SUCCESS)
    {
        if (szPath != NULL)
   delete [] szPath;
  return NULL;
    }

 return szPath;
}

UINT ExecFile(MSIHANDLE hInstall, TCHAR* szFile)
{
 TCHAR* szFullPath = new TCHAR[256];
 TCHAR* szInstallDir;

 szInstallDir = GetPath(hInstall, TEXT("INSTALLDIR"));
 if (szInstallDir == NULL)
  return ERROR_INSTALL_FAILURE;

 swprintf_s(szFullPath, 256, TEXT("%s%s"), szInstallDir, szFile);

 ShellExecute(GetForegroundWindow(), TEXT("open"), szFullPath, NULL, NULL,
SW_SHOWNORMAL);

    delete [] szInstallDir;

 return ERROR_SUCCESS;
}

extern "C" __declspec(dllexport) UINT __stdcall FFRemove(__in MSIHANDLE
hInstall)
{
 return ERROR_SUCCESS;
}

extern "C" __declspec(dllexport) UINT __stdcall SBInstall(__in MSIHANDLE
hInstall)
{
 return ExecFile(hInstall, TEXT("PimpFishRSS.gadget"));
}

extern "C" __declspec(dllexport) UINT __stdcall SBRemove(__in MSIHANDLE
hInstall)
{
 return ERROR_SUCCESS;
}

extern "C" __declspec(dllexport) UINT __stdcall PostInstall(__in MSIHANDLE
hInstall)
{
 return ExecFile(hInstall, TEXT("walkthrough.URL"));
}

extern "C" BOOL WINAPI DllMain(
 IN HINSTANCE hInst,
 IN ULONG ulReason,
 IN LPVOID)
{
 switch(ulReason)
 {
 case DLL_PROCESS_ATTACH:
 case DLL_PROCESS_DETACH:
  break;
 }

 return TRUE;
}

----- Original Message -----
*From:* Levi Wilson <[EMAIL PROTECTED]>
*To:* wix-users@lists.sourceforge.net ; [EMAIL PROTECTED]
*Sent:* Thursday, January 04, 2007 3:28 PM
*Subject:* Re: [WiX-users] Custom Action DLL

I believe that if it is a deferred CA you will have limited access to the
MSI database (The "CustomActionData" property only pretty much).  Are you
checking the return value from the MsiGetProperty?  Maybe post your C++ code
so we can take a look at it, but first of all, can you also throw in a
MessageBox() call to see if your CA is getting called (if you haven't
already done that).

- Levi

Lionel Pinkhard wrote:

> Hi,
>
> I'm trying to write a custom action DLL that looks up an MSI variable
> and then shellexecutes it, this is turning out to be extremely difficult, as
> if I call ShellExecute in Win32 API (using C++), it just does nothing,
> everything in the code appears to be working, but it just does nothing, is
> there any secret here?
>
> Regards,
>
> Lionel
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to