PDA

View Full Version : errors using the autoupdate method



Ganesh Iyer
05-21-2002, 10:49 AM
Hi all
Here's my sample plagiarized code.
when i run this i get the following output
>>Checking for updates
>> error w/ no error code!
>>Done checking for updates

If I run the cmd line
>> "C:\Program Files\Common Files\InstallShield\UpdateService\agent.exe" -au{D0F63BD5-53EF-4EC7-AD47-9F10FF7C8496} -AppMenu

I get a screen that shows me the update i have

Why is it that the autoupdate call does not get the update ?
Or is it getting the update and i'm just printing a wrong stmt.?

-any insigths/ help appreciated
-thanks
-Ganesh
----code sample
cout<< "Checking for updates" << endl;
::CoInitialize(NULL); // initialize the COM agent

USES_CONVERSION;
CComPtr<IAgent2> spAgent;
if (SUCCEEDED(spAgent.CoCreateInstance(CLSID_Agent)))
{
VARIANT_BOOL *updateFound =0; // short ptr
long options =0;
long extraInfo =0;
CComBSTR productCode(L"D0F63BD5-53EF-4EC7-AD47-9F10FF7C8496");
HRESULT hr = spAgent->AutoUpdate(
productCode, TRUE, options, extraInfo, updateFound);
if (FAILED(hr))
{
CComPtr<IErrorInfo> spErrorInfo;
if (::GetErrorInfo(0, &spErrorInfo) == S_OK)
{
CComBSTR bstrDescription;
if (SUCCEEDED(spErrorInfo->GetDescription(&bstrDescription)))
{
cout << "Failed updating reason=" << bstrDescription << endl;;
}
else
{
cout<< "failed getting error description " << endl;
}
}
else
{
cout << " error w/ no error code!" << endl; //WRONG?
}
}
else
{
cout << "auto update call OK" << endl;
}
}
else
cout << "Could not create update Agent object" << endl;

cout << "Done checking for updates" << endl;

Ganesh Iyer
05-21-2002, 10:59 AM
BTW
if i try the command line option w/ AppStart it seems to do
nothing

-Thanks

Sunny's
05-21-2002, 11:05 AM
Please try wrapping product code by { ... } brackets. As in example shown :

Original:
CComBSTR productCode(L"D0F63BD5-53EF-4EC7-AD47-9F10FF7C8496");

Modified:
CComBSTR productCode(L"{D0F63BD5-53EF-4EC7-AD47-9F10FF7C8496}");

Good Luck!

Ganesh Iyer
05-21-2002, 11:16 AM
does not seem make a difference for the auto update call

The error is a big negative number -264...

Ganesh Iyer
05-21-2002, 11:23 AM
also instead of auto update
I tried
HRESULT hr = spAgent->AppUpdate(productCode, AppStart);
and AppMenu and both work fine
The call comes back w/ ok
he menus and installshield is launched fine.

What I am trying to do is to run a silent install that read
the values from a file rather than requiring any
user intervention.

Should I be calling tech support for this?

Thanks a lot