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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Pchar in dll function

Status
Not open for further replies.

neatgadgets

Programmer
Mar 31, 2009
2
AU
I have been trying for months to sort this problem out.

I have a dll that I use with an Authorware application. The dll has a set of functions and procedures that process a word document. The function in question gets a specific bookmark label in the document. The function works fine but it is not returning the result back.

The code interface seems the same as others that work fine. And I have setup the .rc correctly but the error returned is that it is non zero terminated.

I tried putting #0 on the string but that did not help.

The function is:

function Word_Get_Bookmark(oW:TWord; strDocName:pchar; intSequence:Integer): Pchar;
var
strResult:WideString;
begin
strResult := '';

try strResult := oW.Get_Bookmark(strDocName, intSequence);
except on E: Exception do oW.DebugExceptionResult(E, 'Word Get_Bookmark failed') end;
Result := PChar(String(strResult));

end;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top