Copy link to clipboard
Copied
Hello,
While finding text, especially large text, sometimes, it gives me below error:
"The RPC server is unavailable."
When I debugged the code, I came to know that error comes at the function SearchExecuteQueryEx.
Here is my code snippet:
LPCWSTR secName = convertCharArrayToLPCWSTR(sectionName);
LPCWSTR arg = L"value";
LPWSTR searchText;
DWORD size = 1024;
LPCWSTR filePath = convertCharArrayToLPCWSTR(iniFilePath);
//Gets the search text from INI file
GetPrivateProfileStringW(secName, arg, NULL, searchText, size, filePath);
ASText searchKey = ASTextNew();
searchKey = ASTextFromUnicode((ASUTF16Val*)searchText, kUTF16HostEndian);
SearchQueryDataRec srcQuery;
memset(&srcQuery, 0, sizeof (SearchQueryDataRec));
srcQuery.size = sizeof(SearchQueryDataRec);
srcQuery.query = searchKey;
srcQuery.type = kSearchActiveDoc;
srcQuery.scope = kSearchDocumentText | kSearchMarkup;
srcQuery.path = NULL;
srcQuery.fs = NULL;
srcQuery.maxDocs = 1;
ASBool ret = SearchExecuteQueryEx(&srcQuery);
if (ret == false) {
AVAlertNote("Search text not found");
}
ASTextDestroy(searchKey);
It was working previously, I am not getting what is the possible mistake.
Please help.
I am using: Windows 7 and Acrobat Pro XI trial version
Thank you.
Copy link to clipboard
Copied
Hello Navnath,
I think the problem comes from not allocated searchText variable. So, you write anywhere in the memory and the result is obviously unexpected.