Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Handle for MSIGet/SetProperty


2 replies to this topic

vladb

vladb
  • Members
  • 15 posts

Posted 28 May 2004 - 19:02

InstallDev 9
Project Type: InstallScript MSI


I'm trying to get a custom dialog box to get a property for one of my components (the name of a sql server). I'm using a custom property in the Property Manager but I can't set it from my InstallScript.
The MSIGetProperty and MSISetProperty always return ERROR_INVALID_HANDLE! To get the handle i'm using:

GetWindowHandle(HWND_INSTALL) and this returns a positive number.

Here are my calls:

installhandle = GetWindowHandle(HWND_INSTALL);
getresult=MsiGetProperty(installhandle, "SQLSERVER", svSQLServer, nBuffer);
setresult = MsiSetProperty(installhandle,"SQLSERVER",svSQLServer);

How can I get this to work?

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 29 May 2004 - 04:22

What is the value of nBuffer? Try setting it to 256:
CODE

function dostuff( hMSI )
 NUMBER nBuffer;
 STRING szProperty;
begin

// MsiGetProperty buffer size
nBuffer = 256;

MsiGetProperty ( hMSI, "INSTALLDIR", szProperty, nBuffer );

end;


If this doesn't work I would assume the handle you get is invalid.

Edited by Glytzhkof, 29 May 2004 - 06:31.

Regards
-Stein Åsmul

vladb

vladb
  • Members
  • 15 posts

Posted 31 May 2004 - 14:47

Yes, I didn't know what handle to use. That was basically my question, but I found the answer by looking at some examples... The good handle is ISMSI_HANDLE.

Now it works.