1. Mark Jones
  2. PowerBuilder
  3. Thursday, 27 July 2023 17:10 PM UTC

I am using the Amyuni ActiveX controls for PDF processing.   A couple of their methods have output parameters. 

System.Boolean SearchTextEx(System.Int16 Start, System.String Text, [out] System.Int32  Page, [out] System.Double xPos, [out] System.Double yPos)

Here is my code that does not work... 

lb_found=lole_cdintfex.SearchTextEx(-1 , ls_search, li_found_page, ldbl_found_xpos, ldbl_found_ypos) 

This function searches for text and returns the page and position in variables li_found_page, ldbl_found_xpos and ldbl_found_ypos.

It appears that these variables need to be passed by reference,  right now with my current syntax I end up with 0 returned in all these values when I find a string.   Is there a way to pass variables by reference in an ActiveX method?  Is there a workaround e.g using AutomationNativePointers or something like this or possibly a way of overloading the function call by creating my OleObject user object?

Thanks,

   Mark

Accepted Answer
Mark Jones Accepted Answer Pending Moderation
  1. Thursday, 27 July 2023 17:39 PM UTC
  2. PowerBuilder
  3. # Permalink

Well  my apologies for wasting all your time!   Of course there is an easy way to pass variables by reference to OLEMethods , just use the REF parameter...

lb_found=lole_cdintfex.SearchTextEx(-1 , ls_search, REF li_found_page, REF ldbl_found_xpos, REF ldbl_found_ypos)

I did not know this was supported - I wonder when this was introduced.

Mark

Comment
  1. Armeen Mazda @Appeon
  2. Friday, 28 July 2023 02:05 AM UTC
Thanks for sharing the solution!
  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.