PDA

View Full Version : Regsitering COM+ application



woz017
07-06-2005, 08:07 PM
OK I've read about as much documentation as I can stand. :eek:

Does anyone have a recommendation for how to install and register a COM+ application using a pure InstallScript type project.

Everything I read seems to point to using a MSI project and the Component Services features or exporting the application from the MS Windows Component Services application as an MSI file.

I have thought about using an LauchAndWait() call and the .NET utilty REGSVCS - but this will mean my install application will not uninstall the COM+ (Am I right about this?).

Maybe this is just not possible and I will have to change my approach and use an MSI project (of course that will have its own set of issues). If this is what you think I should do please let me know.

Somebody
07-07-2005, 02:44 PM
Maybe this will help you:

Go to http://www.installsite.org/
then select "InstallScript Samples"
then "Operating System"
then scroll down to the "MTS Administration" section.

foldenm
07-11-2005, 11:44 AM
//
// Here is an example of how to create a COM+ Application
// using InstallScript and the COM+ Admin Catalog object.
// Hope this helps!
//
prototype int SetComponentAttribute(OBJECT,BYVAL STRING,VARIANT);

prototype int ConfigureRNComponents(BOOL,BOOL,BOOL);

function int SetComponentAttribute(oAPP,szNAME,varVALUE)
NUMBER nResult;
STRING szMSG;
begin

try
oAPP.Value(szNAME) = varVALUE;
nResult = 0;
catch
nResult = Err.Number;
Sprintf( szMSG,
"Error %lx setting %s. %s",
nResult,
szNAME,
Err.Description );
MessageBox( szMSG, SEVERE );
endcatch;

return nResult;

end; //SetComponentAttribute

function int ConfigureRNComponents()
OBJECT oCAT,oAPPS,oAPP;
NUMBER nResult,i,n;
STRING szPATH,szFN,szNAME,szMSG,szTemp;
begin

nResult = 0;

szPATH = "C:\\SOMEWHERE";
szNAME = "MY_COMPLUS_COMPONENT";

szMSG = "";

try
//
// Attach to the COM+ catalog
//
set oCAT = CoCreateObject("COMAdmin.COMAdminCatalog");

//
// Get the Applications Collection
//
set oAPPS = oCAT.GetCollection("Applications");

//
// Populate the applications collection
//
oAPPS.Populate();

//
// Remove the application if it exists
//
i = 0;
n = oAPPS.Count();

while (i<n)
set oAPP = oAPPS.Item(i);
if oAPP.Name = szNAME then
oCAT.ShutdownApplication(szNAME);
oAPPS.Remove(i);
oAPPS.SaveChanges();
i = n;
else
i = i + 1;
endif;
endwhile;

//
// Create a new application and add it's components
//
set oAPP = oAPPS.Add();

SetComponentAttribute( oAPP, "ID", "{AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE}" );
SetComponentAttribute( oAPP, "Name", szNAME );
SetComponentAttribute( oAPP, "Description", "My COM+ Components" );
SetComponentAttribute( oAPP, "ApplicationDirectory", szPATH);
SetComponentAttribute( oAPP, "ApplicationAccessChecksEnabled", FALSE );
SetComponentAttribute( oAPP, "Activation", 1 );

oAPPS.SaveChanges();

//
// Install components into the application
//
oCAT.InstallComponent( szNAME, szPATH ^ "ABC.DLL", "", "" );
oCAT.InstallComponent( szNAME, szPATH ^ "DEF.DLL", "", "" );
oCAT.InstallComponent( szNAME, szPATH ^ "XYZ.DLL", "", "" );

oAPPS.SaveChanges();

// Start the application if necessary
//oCAT.StartApplication( szNAME );

catch
nResult = Err.Number;
Sprintf(szMSG,
"InstallCOMPlusApplication: Error %lx processing components.\r\n%s",
Err.Number,
Err.Description);
MessageBox(szMSG,SEVERE);
endcatch;

set oCAT = NOTHING;

return nResult;

end; //InstallCOMPlusApplication

woz017
07-12-2005, 05:27 PM
Thanks for the input.