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, Sean - Tracker, Chris - Tracker Supp, 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 » Tue Jun 28, 2016 9:39 am

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)).

User avatar
Sasha - Tracker Dev Team
User
Posts: 4202
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: error COM cast

Post by Sasha - Tracker Dev Team » Tue Jun 28, 2016 9:41 am

Hello Tom,

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

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
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 » Tue Jun 28, 2016 9:44 am

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;
}

User avatar
Sasha - Tracker Dev Team
User
Posts: 4202
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: error COM cast

Post by Sasha - Tracker Dev Team » Tue Jun 28, 2016 9:51 am

Please read this topic - there was a problem with Windows Server with Editor SDK - maybe it would lead you to solution:
http://www.tracker-software.com/forum3/ ... 66&t=26088

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
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 » Tue Jun 28, 2016 9:59 am

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?

User avatar
Sasha - Tracker Dev Team
User
Posts: 4202
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: error COM cast

Post by Sasha - Tracker Dev Team » Tue Jun 28, 2016 10:13 am

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
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Lzcat - Tracker Supp
Site Admin
Posts: 711
Joined: Thu Jun 28, 2007 8:42 am

Re: error COM cast

Post by Lzcat - Tracker Supp » Wed Jun 29, 2016 6:02 am

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