[gme-users] Help with paradigm registration
Krishnakumar B
kitty at dre.vanderbilt.edu
Thu Jul 22 12:40:20 CDT 2004
Hi,
I am trying to make an installer for our toolsuite. As part of finishing up
the installation, I would like to register the paradigm with GME. I saw
some example code in InstallScript which looked something like:
try
set oGME = CreateObject("Mga.MgaRegistrar");
catch
SendErrorMsg(hInstall, "Can't create Mga.MgaRegistrar
object. Please check if you have a valid GME installaton.
\n" + Err.Description, 1);
endcatch;
// System-wide register
nParadigmRegMode = REGACCESS_SYSTEM;
nBuffer = 256;
// Register the UML paradigm
svParadigmDir = INSTALLDIR ^ "etc";
nParadigmRegMode = REGACCESS_USER;
svParadigmName = "UML.xmp";
// User registeration
SendMsgToProgressBar(hInstall, svParadigmName);
try
oGME.RegisterParadigmFromData("XML=" + svParadigmDir ^
svParadigmName, svParadigmRegName, nParadigmRegMode);
catch
SendErrorMsg(hInstall, "Can't register Paradigm
"+svParadigmDir ^ svParadigmName +". Please check if you
have a valid GME installaton. \n" + Err.Description, 1);
endcatch;
I am trying to write a C++ equivalent of the above (with the hope of making
an executable someday which can be installed as a custom action in the MSI
that I am creating). I need some information/help about the internal
functions of GME. If you see the above snippet, it creates a COM object and
calls RegisterParadigmFromData(). So can someone please help me with the
small bit of magic needed to do the same with C++?
I tried the following but it wouldn't compile (obvious since I don't know
COM). Also where can I get information about the API supported by
Mga.MgaRegistrar inteface?
Any help is very much appreciated.
Thanks,
kitty.
UINT __stdcall RegisterParadigm (MSIHANDLE hInstall)
{
// installable paradigm number
int nParadigmNum = 0;
// Initialize progress bar
InitProgressBar(hInstall, nParadigmNum, PARADIGMCOST,
"Paradigm Install",
"Registering Paradigms into GME.", "Registering [1]");
// Try to get the GME COM object
CObject* GME = CreateObject("Mga.MgaRegistrar");
if (GME == NULL)
SendErrorMsg (hInstall, "Can't create Mga.MgaRegistrar object. Please check"
"if you have a valid GME installaton. \n" + LastError(), 1);
const int nBuffer = 256;
char* value = GetRegistryValue (HKEY_LOCAL_MACHINE,
"SOFTWARE\\ISIS\\CoSMIC",
"TargetDir");
if (value == 0)
SendErrorMsg (hInstall, "Unable to access Registry Key TargetDir", 1);
CString targetDir (value);
// Register the PICML paradigm
CString svParadigmDir = targetDir + "paradigms";
// User-wide register
int nParadigmRegMode = REGACCESS_USER;
CString svParadigmName = "PICML.xmp";
// User registeration
SendMsgToProgressBar(hInstall, svParadigmName);
try
{
GME->RegisterParadigmFromData("XML=" + svParadigmDir + svParadigmName,
svParadigmRegName, nParadigmRegMode);
}
catch (...)
{
SendErrorMsg (hInstall, "Unable to register Paradigm " + svParadigmDir +
svParadigmName + ". Please check if you have a valid GME"
"installation. \n" + LastError(), 1);
}
// System Wide registration
nParadigmRegMode = REGACCESS_SYSTEM;
SendMsgToProgressBar(hInstall, svParadigmName);
try
{
GME->RegisterParadigmFromData("XML=" + svParadigmDir + svParadigmName,
svParadigmRegName, nParadigmRegMode);
}
catch (...)
{
SendErrorMsg (hInstall, "Unable to register Paradigm " + svParadigmDir +
svParadigmName + ". Please check if you have a valid GME"
"installation. \n" + LastError(), 1);
}
return ERROR_SUCCESS;
}
More information about the gme-users
mailing list