Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Crystal Reports: PEGetSelectionFormula()
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00081389
Message ID:
00081463
Vues:
19
>>>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!

Michael,

Ian's declaration didn't change any of the type LONGs are the same as INTEGERs (32 bits) in Win 32. What was different was that the values in the your declaration were changed. Initially, you declared them as being passed by value. The second declaration says they're passed by reference (pointers).
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform