Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).


New Forum | Previous | Next | (P-PDF) Developers


Topic: CoCreateInstance problem
Conf: (P-PDF) Developers, Msg: 103752
From: Vovin
Date: 1/13/2004 04:00 AM

Hi,

Can anyone help me with this. I have a small external test program that tests the interface on my plugin. It used to work fine but today it's stopped working for some reason.

It basically fails on the CoCreateInstance method with a return value of -2147024770.

Can anyone tell me why this is happening. Any help would be much appreciated. Thanks in advance. My code is shown below:

void CDigitalSignatureDlg::OnGettestvalue()
{
LaunchAcrobat();
OpenAcrobatDocument("C:\\temp\\blank.pdf");

const IID IID_IDigitalSignature = {0x81258C34,0xA7BD,0x4AD2,{0xA4,0x53,0xB2,0x51,0xC9,0x0E,0xD0,0xCA}};
const IID LIBID_DIGSIGLib = {0xCB8337D2,0x00D9,0x4813,{0xBC,0xAE,0x76,0x24,0xCC,0xE9,0xB4,0xEA}};
const CLSID CLSID_DigitalSignature = {0x1FA1F023,0x96DF,0x43F6,{0xBD,0xDB,0x34,0x9B,0x4C,0xCA,0x40,0x36}};

// Declare and HRESULT and a pointer to
// the Simple_ATL interface
HRESULT hr;
IDigitalSignature *pIDigitalSignature = 0;

// Now we will intilize COM
hr = CoInitialize(0);

// Use the SUCCEEDED macro and see if
// we can get a pointer
// to the interface
if(SUCCEEDED(hr))
{
hr = CoCreateInstance( CLSID_DigitalSignature, NULL,
CLSCTX_INPROC_SERVER,
IID_IDigitalSignature, (void**) &pIDigitalSignature);

// If we succeeded then call the AddNumbers
// method, if it failed
// then display an appropriate message to the user.
if(SUCCEEDED(hr))
{
long testResult = 0;
pIDigitalSignature->GetTestValue(&testResult);
// display message
}
else
{
// display failure message
if(REGDB_E_CLASSNOTREG == hr)
{
AfxMessageBox( "CoCreateInstance failed: REGDB_E_CLASSNOTREG", MB_OK);
}
else if (CLASS_E_NOAGGREGATION == hr)
{
AfxMessageBox( "CoCreateInstance failed: CLASS_E_NOAGGREGATION", MB_OK);
}
else if (S_OK == hr)
{
}
else
{
AfxMessageBox( "CoCreateInstance failed: Unspecified return value", MB_OK);
}
}
}
// Uninitialize COM
if (pIDigitalSignature)
{
pIDigitalSignature->Release();
}
CoUninitialize();

ExitAcrobat();
}


PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Back to the past, 15 years ago! Open Publish 2002

Looking back to 2002, it's amazing how much of the prediction became a reality. Take a read and see what you think!

September 14, 2017
Platinum Sponsor





Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.

Features

Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.