error COM cast

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
Tom Princen
User
Posts: 83
Joined: Wed Mar 25, 2015 10:15 am

error COM cast

Post by Tom Princen »

I got this error on a server. (On my PC everything works fine
Unable to cast COM object of type 'System.__ComObject' to interface type 'PDFXCoreAPI.IPXS_Inst'
This operation failed because the QueryInterface call on the COM component for the interface with IID '{9B44A054-D66C-4AC6-90DB-2E23FBB67EF5}' failed due to the following error: Bad variable type. (Exception from HRESULT: 0x80020008 (DISP_E_BADVARTYPE)).
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: error COM cast

Post by Sasha - Tracker Dev Team »

Hello Tom,

Please provide a code sample so that we can analyze it and advice to your problem.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Tom Princen
User
Posts: 83
Joined: Wed Mar 25, 2015 10:15 am

Re: error COM cast

Post by Tom Princen »

This is the code that generates the error:

if (Initialized == false)
{
MyPXC.Init(lsKey);
//MyPXV.Init(
// MyIPXV = (IPXV_Inst)MyPXC.GetExtension("PXC");
MyIPXS = (IPXS_Inst)MyPXC.GetExtension("PXS");
MyIAUX = (IAUX_Inst)MyPXC.GetExtension("AUX");
Initialized = true;
}
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: error COM cast

Post by Sasha - Tracker Dev Team »

Please read this topic - there was a problem with Windows Server with Editor SDK - maybe it would lead you to solution:
https://forum.pdf-xchange.com/ ... 66&t=26088

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Tom Princen
User
Posts: 83
Joined: Wed Mar 25, 2015 10:15 am

Re: error COM cast

Post by Tom Princen »

I think I found the problem:
It is not threadsave!

You can only use the PXC.Init function from 1 thread?!
What's the best way to solve this?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: error COM cast

Post by Sasha - Tracker Dev Team »

The best thing to do would be provide a small working project sample that we can try and we'll advice you further.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: error COM cast

Post by Lzcat - Tracker Supp »

Hi Tom.
Tom Princen wrote:I think I found the problem:
It is not threadsave!
You will be surprised, but PXC.Init must be called once when loading DLL (or starting application if it does not call LoadLibrary directly). It is common PDF engine initialization and should be done once until program is closed.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Post Reply