Author | Topic: Problem with DECLARE SUB | |
---|---|---|
Roger Donnay | Problem with DECLARE SUB on Mon, 01 Aug 2011 13:45:59 -0600 I am using a Third-party DLL named re_imageconv.dll. The VB samples show the below code. I converted DECLARE FUNCTION to DLLFUNCTION with no problems. Everything works fine. Now I am trying to get the licensing function to work but this is a DECLARE SUB instead of a DECLARE FUNCTION. Does anyone know the Xbase++ equivalent for DECLARE SUB? If I use DLLFUNCTION I get an IDSC. VB Code Samples: 'resizing the image Declare Function ResizeImage Lib "re_imageconv.dll" (ByVal sLoadFlName As String, ByVal sSaveFlName As String, ByVal nHeight As Long) As Long 'cropping the image Declare Function CropImage Lib "re_imageconv.dll" (ByVal sLoadFlName As String, ByVal sSaveFlName As String, ByVal xTop As Long, ByVal yTop As Long, ByVal croppedWidth As Long, ByVal croppedHeight As Long) As Long ' annotating the image Declare Function AnnotateImage Lib "re_imageconv.dll" (ByVal sLoadFlName As String, ByVal sSaveFlName As String, ByVal xLeft As Single, ByVal yLeft As Single, ByVal sAnnotation As String, ByVal FontName As String, ByVal fontpoint As Long, _ ByVal bold As Long, ByVal italic As Long, ByVal under As Long, ByVal strike As Long, _ ByVal crAlpha As Long, ByVal crBlue As Long, ByVal crGreen As Long, ByVal crRed As Long) As Long Declare Function StampImage Lib "re_imageconv.dll" (ByVal sLoadFlName As String, ByVal sSaveFlName As String, ByVal X As Single, ByVal Y As Single, ByVal AnnotationImagePath As String) As Long 'rotating/flipping image Declare Function RotateImage Lib "re_imageconv.dll" (ByVal sLoadFlName As String, ByVal sSaveFlName As String, ByVal angle As Long, ByVal flip As String) As Long 'licensing functions Declare Sub License Lib "re_imageconv.dll" (Password As Long) | |
Pablo Botella | Re: Problem with DECLARE SUB on Mon, 01 Aug 2011 22:12:38 +0200 Hi, There only difference is that the return value of a sub is meaningless ( EAX will contain last used value) so you must just ignore it I think will not be trouble to call them with DllCall() if the proper calling convention used but anyway try also with ot4xb to see if any difference. #include "ot4xb.ch" @re_imageconv:["__vo__sl"]:License( nLicense ) Regards, Pablo | |
Roger Donnay | Re: Problem with DECLARE SUB on Tue, 02 Aug 2011 08:01:37 -0600 Pablo - Thank you for your suggestion. I will give ox4xb a try. "Pablo Botella" wrote in message news:2a0844e8$b37bbe1$265dd@news.alaska-software.com... Hi, There only difference is that the return value of a sub is meaningless ( EAX will contain last used value) so you must just ignore it I think will not be trouble to call them with DllCall() if the proper calling convention used but anyway try also with ot4xb to see if any difference. #include "ot4xb.ch" @re_imageconv:["__vo__sl"]:License( nLicense ) Regards, Pablo | |
Roger Donnay | Re: Problem with DECLARE SUB on Tue, 02 Aug 2011 13:51:34 -0600 Pablo - I determined that the IDSC was caused by failure to use the pass-by-reference operator. I assumed it was not necessary, but apparently it is. This works: STATIC FUNCTION ReImageConvLicense() LOCAL cDate := Dtos(Date()), nPassWord := 0, i FOR i := 1 TO Len(cDate) nPassword += Val(cDate[i]) NEXT nPassword += 1971 License( @nPassword ) RETURN nil * --------------- STATIC DLLFUNCTION License( @nPassword ) USING STDCALL FROM re_imageconv.dll "Pablo Botella" wrote in message news:2a0844e8$b37bbe1$265dd@news.alaska-software.com... Hi, There only difference is that the return value of a sub is meaningless ( EAX will contain last used value) so you must just ignore it I think will not be trouble to call them with DllCall() if the proper calling convention used but anyway try also with ot4xb to see if any difference. #include "ot4xb.ch" @re_imageconv:["__vo__sl"]:License( nLicense ) Regards, Pablo |