Hi All,

Here is a simple Product.wxs:

<?xml version="1.0" encoding="UTF-8"?>
<Wix
xmlns="http://schemas.microsoft.com/wix/2006/wi";>
  <Product
Id="{BEC8D2EB-A59C-4D72-8CBB-3DC35FA8C8E2}"
UpgradeCode="{2FAAAB9D-E0BF-4AD8-B41B-22A78AF79326}"
Name="FredProgram" Language="1033"
Version="1.0.0.0" Manufacturer="Freds Computing Services">
    <Package Id="*"
Description="Freddie" InstallerVersion="200"
Compressed="yes" />

    <Media Id="1"
Cabinet="Product.cab" EmbedCab="yes" />

    <Property
Id="MYPROP">0</Property>
    
    <Directory
Id="TARGETDIR" Name="SourceDir">
      <Directory
Id="ProgramFilesFolder">
       
<Directory Id="INSTALLDIR" Name="FredSoft">

         
<Component Id="FredAppFile"
Guid="{59CB9547-E5CA-49FA-814F-248716487E54}">
           
<File Id='fred_exe' Name='fred.exe' DiskId='1' Source='C:\fred.exe'
Vital='yes' />
         
</Component>
         
<Component Id="FredDocFile"
Guid="{803BBE51-9B42-410B-A9A8-C4E64E03221E}">
           
<File Id='fred_txt' Name='fred.txt' DiskId='1' Source='C:\fred.txt' />
         
</Component>

       
</Directory>
      </Directory>
    </Directory>

    <Feature
Id="FredApp" Title="Fred Application"
Level="1">
      <ComponentRef
Id="FredAppFile" />
    </Feature>
    
    <Feature
Id="FredDoc" Title="Fred Document" Level="0">
      <ComponentRef
Id="FredDocFile" />
      <Condition
Level="1">MYPROP = 1</Condition>
    </Feature>
    
    <CustomAction
Id='CheckSystem' BinaryKey='CheckSystem' DllEntry='CheckSystem' />

    <InstallUISequence>
      <Custom
Action='CheckSystem' After='CostFinalize'>NOT Installed</Custom>
    </InstallUISequence>

    <Binary Id='CheckSystem'
SourceFile='FredInst\FredInst.dll' />
    
  </Product>

</Wix>



Here is some VC++ code to create the FredInst.dll:

Fred.h

#ifndef
AFX_ATRINST_H__551D5579_9FC9_4CCD_A568_A963C839F6B8__INCLUDED_
#define
AFX_ATRINST_H__551D5579_9FC9_4CCD_A568_A963C839F6B8__INCLUDED_

// Make our life easier, if DLL_EXPORT is defined
in a file then DECLDIR will do an export
// If it is not defined DECLDIR will do an import
#if defined DLL_EXPORT
#define DECLDIR __declspec(dllexport)
#else
#define DECLDIR __declspec(dllimport)
#endif

#ifndef _AFXDLL
#define _AFXDLL
#endif

#include <iostream>
#include <afx.h>
#include <msi.h>
using namespace std;

extern "C" DECLDIR UINT
CheckSystem(MSIHANDLE);

// End the inclusion guard
#endif


Fred.cpp:

// DECLDIR will perform an export for us
#define DLL_EXPORT

// Include our header, must come after #define
DLL_EXPORT
#include "Fred.h"
#include <msiquery.h>

MSIHANDLE hMsi;

extern "C" DECLDIR UINT
CheckSystem(MSIHANDLE hMsi)
{
    MessageBox(NULL,
_T("Hello"), _T("CheckSystem"), MB_OK);
    MsiSetProperty(hMsi,
_T("MYPROP"), _T("1"));
    return ERROR_SUCCESS;
}


The problem I'm having is that although the MYPROP property is
being set ok from the DLL (which the install log confirms), theFredDoc feature
is not being installed, implying that its Level is not being changed to 1.

Can anybody please help me out here? Many thanks
for your time and attention.

Regards,
Andrew Kendall

Send instant messages to your online friends http://uk.messenger.yahoo.com 
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to