Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TIWIPGeolocationClient::Execute() always false
#4
(05-28-2025, 09:21 AM)JuergenS Wrote: Unfortunately, these property variables could not be changed by my application:
...
Apparently the current implementation under C++Builder does not work as described below:

https://docwiki.embarcadero.com/RADStudi...ss_Methods

MaxErrorCount and Enabled are not "class methods", they are "class properties" instead, so this documentation would be more relevant:

https://docwiki.embarcadero.com/RADStudi...Properties

But either way, C++Builder supports accessing class/static properties though the class type as well as through an object pointer.  Are you claiming that is not the case? IOW, what does this code report to you?

Code:
TIWIPGeolocationClient* pCurClient = new TIWIPGeolocationClient(this);

TIWIPGeolocationClient::MaxErrorCount = 15;
ShowMessage(pCurClient->MaxErrorCount); // should be 15

pCurClient->MaxErrorCount = 5;
ShowMessage(TIWIPGeolocationClient::MaxErrorCount); // should be 5

TIWIPGeolocationClient::Enabled = false;
ShowMessage(pCurClient->Enabled); // should be false

pCurClient->Enabled = true;
ShowMessage(TIWIPGeolocationClient::Enabled); // should be true

// Interface and key
pCurClient->IPGeoApiInterface = TIPGeoApiInterface(CurIndex);
pCurClient->ApiKey = theApiKey;

// Execute GeoApi function
if(pCurClient->Execute(theIPAddress))
{
     // Retrieve API response
}

(05-29-2025, 11:13 AM)JuergenS Wrote: This version is now running:

On a side note:

- new does not return NULL/nullptr on failure, instead it throws a std::bad_alloc exception.

- have you considered using TIWIPGeolocationHelper (added in 15.2.55) to simplify use of TIWIPGeolocationClient?
   
Quote:New TIWIPGeolocationHelper class exposes a simple interface to use with TIWIPGeolocationClient class. Now you can implement IPGeolocation for your sessions with 2 lines of code!   

Reply


Messages In This Thread
RE: TIWIPGeolocationClient::Execute() always false - by rlebeau - 05-29-2025, 04:51 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)