C++ - Function calls returning TA_E_PDETS

Hello, I am trying to implement TurboActivate with a C++ Mac application. I have used the static way of integrating turboActivate.I have created my class with some methods in which i would like to utilize the TurboActivate functionality.

I was not able to find any example for this one and the samples & online tutorials provided cannot clarify my problem.(any links to any resources would be appreciated).In one particular method, i would like the user to enter their product key and activate their installation.

It is my understanding that the following steps must be taken to implement this. 1. I up to now chose to set the path for the dat file in some test folder. So when my activation method is called i load the .dat file from there. PDetsFromPath returns TA_OK.2. After that, i call CheckAndSavePKey for storing the Product key the user entered.3. call Activate(or perhaps IsProductKeyValid before it)and that should be a rough plan.

Also the thing is that all but the TrialDaysRemaining(...) function is called correctly, which is code provided online.

So is my understanding as to how things work ok?Should calling PDetsFromPath be made whenever a method is called?Why is it that although the file is loaded, all functions i have tried return this error?Also, is the TrialDaysRemaining(..) using only the dat file, and that is why not other errors are produced?

>> "I was not able to find any example for this one and the samples & online tutorials provided cannot clarify my problem."

The C example is a good place to start: http://wyday.com/limelm/help/using-turboactivate-with-c-plus-plus/

It shows how to use the API and where to put the TurboActivate.dat file (in the same folder as the executable).

>> "1. I up to now chose to set the path for the dat file in some test folder. So when my activation method is called i load the .dat file from there. PDetsFromPath returns TA_OK."

If you've renamed the TurboActivate.dat to something else, or you've moved it to a folder that is not the same as the executable's folder, then you need to call PDetsFromPath() once (and only once) before you call any other TurboActivate function.

>> "Why is it that although the file is loaded, all functions i have tried return this error?"

Because you didn't actually load it correctly. You need to check error codes.

>> "Also, is the TrialDaysRemaining(..) using only the dat file, and that is why not other errors are produced?"

I don't know what you're asking.

Hello and thanks for the response.

Well yes the C sample was clarifying. Yet the error returned by the CheckAndSavePKey had me chasing witches.Though PDetsFromPath from path returned TA_OK, after that calling CheckAndSavePKey returned TA_E_PDETS. Which means, dat file not loaded.The problem was the way i handled strings. Converting and passing an std::string. I basically stumbled on this. Tried various combinations and now everything works fine.

One last question. I have implemented free static functions in a namespace for using TurboActivate. Should the PDetsFromPath be called when ever a function is called?If i implement a class should i call it in the constructor once and then its methods will not need to make the call?

Thank you in advance

>> "Should the PDetsFromPath be called when ever a function is called?"

No, just call it once before you call any other TurboActivate function. So, once at the top of your app.

>> "If i implement a class should i call it in the constructor once and then its methods will not need to make the call?"

Yes.