>>I'm having a problem with this particular function in crystal reports. Whenever I try to use it from VFP (via a DECLARE) I get the "this program has performed an...blah blah blah" error box and VFP crashes. In the crystal reports documentation this function is defined as:
>>****************
>>BOOL CRPE_API PEGetSelectionFormula (
>> short printJob,
>> handle FAR *texthandle,
>> short FAR *textlength ) ;
>>****************
>>
>>My declare statements is :
>>****************
>>DECLARE PEGetSelectionFormula IN CRPE32.DLL ;
>> short printjobs, integer texthandle, short textlength
>>****************
>>
>>Finally, the code that is crashing is:
>>****************
>>lnTextHandle = 0
>>lnTextLength = 0
>>=PEGetSelectionFormula( lhPrintJob, @lnTextHandle, @lnTextLength )
>>****************
>>
>>Is this not the correct way to pass FAR pointers or something?
>
>PARAMETERS tnTextHandle, tnTextLength
>LOCAL lnJobHandle, lnStatus
>
>lnStatus = THIS.GetJobHandle( lnJobHandle)
>IF lnStatus > 0
> RETURN lnStatus
>ENDIF
>
>DECLARE INTEGER PEGetSelectionFormula IN crpe32.dll INTEGER, LONG @, INTEGER @
>
>lnStatus = PEGetSelectionFormula( lnJobHandle, tnTextHandle, tnTextLength)
>
>IF lnStatus = 0
> THIS.GetErrorText()
> lnStatus = _CrystalError
>ELSE
> lnStatus = 0
>ENDIF
>
>RETURN lnStatus
>
>The above code is how we access the function - we have UDFparms set to reference.
>
>Ian
Thanks Ian! This did the trick. What I find odd is that the CR documentation defines the parameters as one type, e.g. short, and we have to define them as another type for it to work properly. Very annoying.
Thanks again!