Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AnsiString::LoadStr

Status
Not open for further replies.

sasanvm

Programmer
Aug 15, 2011
2
IR
Hello,

I call AnsiString::LoadStr in sub thread (no main thread),
sub thread work on database records that take long time for process.

At first that work fone, but after a long time thread working , LoadStr return null !
Why this happens ?

Application is VCL form, BCB 2007 with run time package enable.

Regards,
sasan.
 
Can you show us your code?


James P. Cottingham
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Hello,

In every record process at first load encryption must be down in this code:

AnsiString __fastcall TGlobal::CRC_LoadEncryption()
{
AnsiString Password2 = EmptyStr;

bool Result;
AnsiString Password1, sTemp;

sTemp = sTemp.LoadStr(IDS_PASSWORD1);
if (sTemp.IsEmpty())
throw Exception("Error load ecryption #ID1 is null.");
Result = ECLDecompressAndDecryptString(sTemp, Password1, "");
if ( !Result )
throw Exception("Error decryption string level #1.");

sTemp = sTemp.LoadStr(IDS_PASSWORD2);
if (sTemp.IsEmpty())
throw Exception("Error load ecryption #ID2 is null.");
Result = ECLDecompressAndDecryptString(sTemp, Password2, Password1);
if ( !Result )
throw Exception("Error decryption string level #2.");

return Password2;
}

and then record processed, but after long time first call to LoadStr return null.

regards,
sasan.
 
I don't use LoadStr much so I'm guessing. Do you know what the instance handle of the module that contains the string resource is? If so, try "sTemp = sTemp.LoadStr(hinstance, IDS_PASSWORD1);"

Another question, have you bound a string table resource bound to your executable program?

Have you tried the stand-alone version, e.g., AnsiString s = LoadStr(IDS_PASSWORD1)?

Finally, are you sure IDS_PASSWORD1 is an integer?


James P. Cottingham
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top