How to get SDK version in C# ?

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
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

How to get SDK version in C# ?

Post by whoit »

Hi -

Do you have sample C# code that gets the SDK version (of Core API)?

I'm looking to have the return expressed as xx.xx.xx.xx (7.0.324.3).

Thanks.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: How to get SDK version in C# ?

Post by Tracker Supp-Stefan »

Hello Whoit,

I believe this is the thing you need:
https://sdkhelp.pdf-xchange.com/vi ... APIVersion

And a sample on how to use the code is given for the Editor layer here:
https://sdkhelp.pdf-xchange.com/vi ... APIVersion

Cheers,
Stefan
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: How to get SDK version in C# ?

Post by whoit »

Hi Stefan -

Thanks - I found the API before, but the problem is that the sample is in C++
and I was looking for a C# sample.
Do you have that?

Thanks.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to get SDK version in C# ?

Post by Sasha - Tracker Dev Team »

Hello Whoit,

Well we don't have the C# sample for this method. The C++ sample is pretty straightforward and easy to understand with moderate programming skills so I don't see a problem here.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: How to get SDK version in C# ?

Post by whoit »

I must be missing something then, because when I look at the example code and read the description,
it appears to take in 4 separate values (1,2,0,0) and pack them into a single ULONG:

Code: Select all

#define MAKE_API_VERSION(majver, minver, build, subbuild)       ((majver) << 24) | ((minver) << 16) | ((build) << 8) | (subbuild)
#define REQ_VER    MAKE_API_VER(1, 2, 0, 0)

bool IsValidSDK(PXV_Inst* pInst)
{
    ULONG nVer;
    pInst->get_APIVersion(&nVer);
    return (nVer >= REQ_VER);
}
The example even states:
As a result, for example, current version (1.2.0.0) of the SDK will have a value: 0x01020000
The Core API "APIVersion" returns a long: "17367040"....

But what I'm trying to do is get the release version "7.0.324.3"
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to get SDK version in C# ?

Post by Sasha - Tracker Dev Team »

Hello Wayne,

Well, the 17367040 in decimal is 0x1090000 in hex (the 0x means hex in numeric values)...
As for the version that you want - you should obtain it directly from the dll. Here's a link that should help:
https://stackoverflow.com/questions/175 ... r-of-a-dll

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
whoit
User
Posts: 269
Joined: Tue Jul 07, 2015 3:30 pm

Re: How to get SDK version in C# ?

Post by whoit »

Hi Alex -

Regarding the hex value, I was pointing out that the sample code does not get the version, it sets the version
and does so by packing the four integers supplied (1,2,0,0) into a single ULONG which is shown as hex 0x1020000.
Converting the value returned from the APIVersion call (17367040) into hex does not yield an accurate value.

So, I'm not certain what the value returned from APIVersion (17367040) is...
If there's a way to convert it to "7.0.324.3", that's great - but if there is no relationship between the two values, then
I don't understand what APIVersion returns.

As for the .Net - here's some code to produce the exact output I'm looking for, in case anyone else needs it:

Code: Select all

FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(@"C:\Program Files (x86)\Tracker Software\Core API SDK\Bin\PDFXCoreAPI.x86.dll");
String myVers = String.Format("V{0}.{1}.{2}.{3}", myFileVersionInfo.FileMajorPart, myFileVersionInfo.FileMinorPart, myFileVersionInfo.FileBuildPart, myFileVersionInfo.FilePrivatePart);
Debug.WriteLine("File: " + myFileVersionInfo.FileDescription + '\n' + "Version number: " + myVers);
Thanks.
Last edited by whoit on Wed Apr 04, 2018 2:00 pm, edited 1 time in total.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to get SDK version in C# ?

Post by Sasha - Tracker Dev Team »

Hello Wayne,

The API version is changed when some new methods/properties are added to the interfaces. So basically you can check whether something new was added or not.
Well, the 17367040 in decimal is 0x1090000 in hex
Basically the version here is 1.9.0.0, while the code sample version was still 1.2.0.0

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply