new to dll calls

xxxcapxxx

New Member
First of all i must say hi to everyone here.

I freshly started to use ABL and i've been asked to try myself on that dll . I am surely being missing something so I hope someone here may help me out a bit.


/*************************/

/* Procedure verificating version*/
/************************/
/*definition des variables*/
DEFINE VAR ipdwMajor AS INTEGER INITIAL 0 NO-UNDO.
DEFINE VAR ipdwMinor AS INTEGER INITIAL 0 NO-UNDO.
DEFINE VAR cpszValidUntil AS CHARACTER NO-UNDO.
DEFINE VAR inValidLen AS INTEGER NO-UNDO.
DEFINE VAR iResult AS INTEGER NO-UNDO.

/*definition de la procedure*/
/*declaration de la methode d'appel CDECL de la dll*/
PROCEDURE IT_IBANVersion EXTERNAL"IBANKernel.dll":U CDECL PERSISTENT:
/*pointer for version majeur*/
DEFINE INPUT-OUTPUT PARAMETER pdwMajor AS HANDLE TO LONG.
/*pointer for version minor*/
DEFINE INPUT-OUTPUT PARAMETER pdwMinor AS HANDLE TO LONG.
/*pointer for date*/
DEFINE INPUT-OUTPUT PARAMETER pszValidUntil AS HANDLE TO CHAR.
/*buffer for date length*/
DEFINE INPUT PARAMETER nValidLen AS HANDLE TO LONG.
/*reponse 0=erreur, la version ne peut pas etre determinée*/
DEFINE RETURN PARAMETER infoResult AS HANDLE TO LONG.
END PROCEDURE.

/*Execution de la procedure*/
RUN IT_IBANVersion (OUTPUT ipdwMajor,

OUTPUT ipdwMinor,
OUTPUT cpszValidUntil,
OUTPUT inValidLen).
/*renvoi le resultat*/
/*MESSAGE cpszValidUntil VIEW-AS ALERT-BOX INFO BUTTONS OK.*/

it keeps telling that i have mismatched parameters types passed to procedure.
maybe i don't understand what it exactly is as I am not use enough to english.

Thank you
 

FrancoisL

Member
If your signature is ok , here is what i think the call should be but i can't be sure since i don't know your dll procedure signature.

DEFINE VAR ipdwMajor AS INTEGER INITIAL 0 NO-UNDO.
DEFINE VAR ipdwMinor AS INTEGER INITIAL 0 NO-UNDO.
DEFINE VAR cpszValidUntil AS MEMPTR NO-UNDO.
DEFINE VAR inValidLen AS INTEGER NO-UNDO.
DEFINE VAR iResult AS INTEGER NO-UNDO.
DEF VAR cDate AS CHAR.
/*definition de la procedure*/
/*declaration de la methode d'appel CDECL de la dll*/
PROCEDURE IT_IBANVersion EXTERNAL"IBANKernel.dll":U CDECL PERSISTENT:
/*pointer for version majeur*/
DEFINE INPUT-OUTPUT PARAMETER pdwMajor ASLONG.
/*pointer for version minor*/
DEFINE INPUT-OUTPUT PARAMETER pdwMinor AS LONG.
/*pointer for date*/
DEFINE INPUT-OUTPUT PARAMETER pszValidUntil AS MEMPTR.
/*buffer for date length*/
DEFINE INPUT PARAMETER nValidLen AS LONG.
/*reponse 0=erreur, la version ne peut pas etre determinée*/
DEFINE RETURN PARAMETER infoResult AS LONG.
END PROCEDURE.

/*Execution de la procedure*/

SET-SIZE(
cpszValidUntil) = 64.
RUN IT_IBANVersion
(
INPUT-OUTPUT ipdwMajor,
INPUT-OUTPUT ipdwMinor,
INPUT-OUTPUT cpszValidUntil,
INPUT 64,
OUTPUT iResult ).

cDate = GET-STRING(pszValidUntil, 1).

SET-SIZE(cpszValidUntil) = 0.
 

xxxcapxxx

New Member
Thanks for your help , but i am still stuck somehow...

Thanks for you help.
Here's the prototype of the dll:

Code:
int IT_IBANVersion (
DWORD *pdwMajor, // [in/out] mandatory
DWORD *pdwMinor, // [in/out] mandatory
char *pswzValidThru, // [in/out] mandatory
int nValidThruLen); // [in] mandatory

i tried your with what you told, the error slightly changed from :
Mismatched parameter types passed to procedure (3230).
to:
Mismatch in the parameter datatypes in DLL procedure <procedure>. (3231)

I must also say that nValidThruLen must at least return a size of 9 bytes for the date buffer.

I also have this C# code to help out a bit. It's given by dll autor's

Code:
[DllImport("IBANKernel.dll")]
static extern int IT_IBANVersion(
ref int dwMajor,
ref int dwMinor,
StringBuilder lpszValidThru,
ref int nValidThruLen);
 
StringBUilder sbValidThru = new StringBuilder(32);
int nMajor = 0;
int nMinor = 0;
int nResult = IT_IBANVersion (
ref nMajor, // Buffer for Major-V.
ref nMinor, // Buffer for Minor-V.
strDate, // Buffer for date.
strDate.Capacity);

thanks for your help I appreciate it.
 

dbratu

New Member
This a Progress code that works:


/* replace with actual location of the DLL or just with the name of the DLL if localed in <windows\system32 */
&scoped-define IBANKERNEL_DLL E:\temp\dl_tkicch_standardisierung_ibantool\IBANKernel.dll
DEFINE VAR pdwMajor AS memptr NO-UNDO.
DEFINE VAR pdwMinor AS memptr NO-UNDO.
DEFINE VAR pszValidUntil AS memptr NO-UNDO.
DEFINE VAR nValidLen AS INTEGER NO-UNDO.
DEFINE VAR iResult AS INTEGER NO-UNDO.
DEFINE VAR dwMajor AS integer NO-UNDO.
DEFINE VAR dwMinor AS integer NO-UNDO.
define var szValidUntil as char no-undo.
szValidUntil = "".
nValidLen = 10. /* e.g. 31.12.2007 */
set-size(pdwMajor) = 4.
set-size(pdwMinor) = 4.
set-size(pszValidUntil) = nValidLen + 1.
/*Execution de la procedure*/
RUN IT_IBANVersion (input pdwMajor,
input pdwMinor,
input pszValidUntil,
input nValidLen,
output iResult).
if iResult <> 0 then do:
dwMajor = get-short(pdwMajor, 1).
dwMajor = get-short(pdwMinor, 1).
szValidUntil = get-string(pszValidUntil, 1).

MESSAGE "iResult=" iResult skip
"dwMajor=" dwMajor skip
"dwMinor=" dwMinor skip
"szValidUntil=" szValidUntil
VIEW-AS ALERT-BOX INFO BUTTONS OK.
end.
else do:
MESSAGE "Error: iResult=" iResult
VIEW-AS ALERT-BOX INFO BUTTONS OK.
end.
set-size(pdwMajor) = 0.
set-size(pdwMinor) = 0.
set-size(pszValidUntil) = 0.
/* at the end release external DLL */
release external "{&IBANKERNEL_DLL}":U.
return.

/*definition de la procedure*/
/*declaration de la methode d'appel CDECL de la dll*/
PROCEDURE IT_IBANVersion EXTERNAL "{&IBANKERNEL_DLL}":U CDECL PERSISTENT:
DEFINE INPUT PARAMETER pdwMajor AS MEMPTR. /*pointer for version majeur*/
DEFINE INPUT PARAMETER pdwMinor AS MEMPTR. /*pointer for version minor*/
DEFINE INPUT PARAMETER pszValidUntil AS MEMPTR. /*pointer for date*/
DEFINE INPUT PARAMETER nValidLen AS LONG. /*buffer for date length*/
DEFINE RETURN PARAMETER infoResult AS LONG. /*reponse 0=erreur, la version ne peut pas etre determinée*/
END PROCEDURE.
 

xxxcapxxx

New Member
Thank you very much Dbratu !
I was far from there, many coding behaviour I am not used to.
I will use it to get better understanding of how it works.

thanks again you rock !
 

dbratu

New Member
Looking again, it seems that there are 2 errors in my code:
- please replace get-short with get-long (to read 32 bits - 4 bytes)

Regards,
Daniel
 

xxxcapxxx

New Member
Thx again,
btw using the debugger i see that the input here is correct but what i finally get is totally weird:


dwMajor =
GET-LONG(pdwMajor, 1).
dwMinor = GET-LONG(pdwMinor, 1).

the result i have is
pdwMajor : (4) 01 00 04 00
pdwMinor : (4) 01 00 01 00
pszValidUntil : (11) 32 30 30 37 30 38 33 31 00 00 00
nValidLen :10
iResult : 1
dwMajor : 262145 i should get here 1 0 4 0
dwMinor : 65537 i should get here 1 0 1 0

szValidUntil : "20070831" -> that is 2007.08.31

as you can see something breaks but i wonder what as it works correctly for szValidUntil.

 

dbratu

New Member
You can leave the version and try to do a conversion. There is a pdf with a sample, check that you receive the same result.

Daniel
 

xxxcapxxx

New Member
yep actually, the version was the first step of my job ! Now ill try myself on that conversion thing , but you helped me a lot. ;)

btw i managed to resolve the little bugs i still had i am quite satisfied of it.

here's what it looks like now
Code:
[LEFT][SIZE=2][COLOR=#8b7e66]&scoped-define IBANKERNEL_DLL IBANKernel.dll [/COLOR][/SIZE][/LEFT]
 
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]VAR[/COLOR][/SIZE][SIZE=2] pdwMajor [/SIZE][SIZE=2][COLOR=#7f0055]AS [/COLOR][/SIZE][SIZE=2][COLOR=#cd3a3a]MEMPTR [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]NO-UNDO.[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]VAR[/COLOR][/SIZE][SIZE=2] pdwMinor [/SIZE][SIZE=2][COLOR=#7f0055]AS [/COLOR][/SIZE][SIZE=2][COLOR=#cd3a3a]MEMPTR [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]NO-UNDO.[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]VAR[/COLOR][/SIZE][SIZE=2] pszValidUntil [/SIZE][SIZE=2][COLOR=#7f0055]AS [/COLOR][/SIZE][SIZE=2][COLOR=#cd3a3a]MEMPTR [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]NO-UNDO.[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]VAR[/COLOR][/SIZE][SIZE=2] nValidLen [/SIZE][SIZE=2][COLOR=#7f0055]AS [/COLOR][/SIZE][SIZE=2][COLOR=#cd3a3a]INTEGER [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]NO-UNDO.[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]VAR[/COLOR][/SIZE][SIZE=2] iResult [/SIZE][SIZE=2][COLOR=#7f0055]AS [/COLOR][/SIZE][SIZE=2][COLOR=#cd3a3a]INTEGER [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]NO-UNDO.[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]VAR[/COLOR][/SIZE][SIZE=2] idwMajor1 [/SIZE][SIZE=2][COLOR=#7f0055]AS [/COLOR][/SIZE][SIZE=2][COLOR=#cd3a3a]INTEGER [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]NO-UNDO.[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]VAR[/COLOR][/SIZE][SIZE=2] idwMajor2 [/SIZE][SIZE=2][COLOR=#7f0055]AS [/COLOR][/SIZE][SIZE=2][COLOR=#cd3a3a]INTEGER [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]NO-UNDO.[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]VAR[/COLOR][/SIZE][SIZE=2] idwMinor1 [/SIZE][SIZE=2][COLOR=#7f0055]AS [/COLOR][/SIZE][SIZE=2][COLOR=#cd3a3a]INTEGER [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]NO-UNDO.[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]VAR[/COLOR][/SIZE][SIZE=2] idwMinor2 [/SIZE][SIZE=2][COLOR=#7f0055]AS [/COLOR][/SIZE][SIZE=2][COLOR=#cd3a3a]INTEGER [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]NO-UNDO.[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]VAR[/COLOR][/SIZE][SIZE=2] szValidUntil [/SIZE][SIZE=2][COLOR=#7f0055]AS [/COLOR][/SIZE][SIZE=2][COLOR=#cd3a3a]CHAR [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]NO-UNDO.[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]VAR[/COLOR][/SIZE][SIZE=2] cYear [/SIZE][SIZE=2][COLOR=#7f0055]AS [/COLOR][/SIZE][SIZE=2][COLOR=#cd3a3a]INT [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]NO-UNDO.[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]VAR[/COLOR][/SIZE][SIZE=2] cMonth [/SIZE][SIZE=2][COLOR=#7f0055]AS [/COLOR][/SIZE][SIZE=2][COLOR=#cd3a3a]INT [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]NO-UNDO.[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]VAR[/COLOR][/SIZE][SIZE=2] cDay [/SIZE][SIZE=2][COLOR=#7f0055]AS [/COLOR][/SIZE][SIZE=2][COLOR=#cd3a3a]INT [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]NO-UNDO.[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]VAR[/COLOR][/SIZE][SIZE=2] ddDate [/SIZE][SIZE=2][COLOR=#7f0055]AS [/COLOR][/SIZE][SIZE=2][COLOR=#cd3a3a]DATE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]NO-UNDO.[/COLOR][/SIZE]
 
 
[LEFT][SIZE=2][COLOR=#3f7f5f]/*initialisation*/[/COLOR][/SIZE][/LEFT]
[SIZE=2]szValidUntil = [/SIZE][SIZE=2][COLOR=#2a00ff]""[/COLOR][/SIZE][SIZE=2].[/SIZE]
[SIZE=2]nValidLen = [/SIZE][SIZE=2][COLOR=#2a00ff]10[/COLOR][/SIZE][SIZE=2]. [/SIZE][SIZE=2][COLOR=#3f7f5f]/* e.g. 31.12.2007 */[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]set-size[/COLOR][/SIZE][SIZE=2](pdwMajor) = [/SIZE][SIZE=2][COLOR=#2a00ff]4[/COLOR][/SIZE][SIZE=2].[/SIZE]
[SIZE=2][COLOR=#7f0055]set-size[/COLOR][/SIZE][SIZE=2](pdwMinor) = [/SIZE][SIZE=2][COLOR=#2a00ff]4[/COLOR][/SIZE][SIZE=2].[/SIZE]
[SIZE=2][COLOR=#7f0055]set-size[/COLOR][/SIZE][SIZE=2](pszValidUntil) = nValidLen + [/SIZE][SIZE=2][COLOR=#2a00ff]1[/COLOR][/SIZE][SIZE=2].[/SIZE]
 
 
[LEFT][SIZE=2][COLOR=#3f7f5f]/*Execution de la procedure*/[/COLOR][/SIZE][/LEFT]
[SIZE=2][COLOR=#7f0055]RUN [/COLOR][/SIZE][SIZE=2]IT_IBANVersion ([/SIZE][SIZE=2][COLOR=#7f0055]INPUT[/COLOR][/SIZE][SIZE=2] pdwMajor,[/SIZE]
[SIZE=2][COLOR=#7f0055]INPUT[/COLOR][/SIZE][SIZE=2] pdwMinor,[/SIZE]
[SIZE=2][COLOR=#7f0055]INPUT[/COLOR][/SIZE][SIZE=2] pszValidUntil,[/SIZE]
[SIZE=2][COLOR=#7f0055]INPUT[/COLOR][/SIZE][SIZE=2] nValidLen,[/SIZE]
[SIZE=2][COLOR=#7f0055]OUTPUT[/COLOR][/SIZE][SIZE=2] iResult).[/SIZE]
 
[LEFT][SIZE=2][COLOR=#3f7f5f]/*valide*/[/COLOR][/SIZE][/LEFT]
[SIZE=2][COLOR=#7f0055]IF [/COLOR][/SIZE][SIZE=2]iResult = [/SIZE][SIZE=2][COLOR=#2a00ff]1[/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]THEN [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]DO[/COLOR][/SIZE][SIZE=2]:[/SIZE]
[SIZE=2]idwMajor1 = [/SIZE][SIZE=2][COLOR=#7f0055]GET-BYTE[/COLOR][/SIZE][SIZE=2] (pdwMajor, [/SIZE][SIZE=2][COLOR=#2a00ff]3[/COLOR][/SIZE][SIZE=2]).[/SIZE]
[SIZE=2]idwMajor2 = [/SIZE][SIZE=2][COLOR=#7f0055]GET-BYTE[/COLOR][/SIZE][SIZE=2](pdwMajor, [/SIZE][SIZE=2][COLOR=#2a00ff]1[/COLOR][/SIZE][SIZE=2]).[/SIZE]
[SIZE=2]idwMinor1 = [/SIZE][SIZE=2][COLOR=#7f0055]GET-BYTE[/COLOR][/SIZE][SIZE=2](pdwMinor, [/SIZE][SIZE=2][COLOR=#2a00ff]3[/COLOR][/SIZE][SIZE=2]).[/SIZE]
[SIZE=2]idwMinor2 = [/SIZE][SIZE=2][COLOR=#7f0055]GET-BYTE[/COLOR][/SIZE][SIZE=2](pdwMinor, [/SIZE][SIZE=2][COLOR=#2a00ff]1[/COLOR][/SIZE][SIZE=2]).[/SIZE]
[SIZE=2]szValidUntil = [/SIZE][SIZE=2][COLOR=#7f0055]GET-STRING[/COLOR][/SIZE][SIZE=2](pszValidUntil, [/SIZE][SIZE=2][COLOR=#2a00ff]1[/COLOR][/SIZE][SIZE=2]).[/SIZE]
[SIZE=2]cYear = [/SIZE][SIZE=2][COLOR=#cd3a3a]INTEGER[/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#7f0055]SUBSTRING[/COLOR][/SIZE][SIZE=2](szValidUntil,[/SIZE][SIZE=2][COLOR=#2a00ff]1[/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#2a00ff]4[/COLOR][/SIZE][SIZE=2])).[/SIZE]
[SIZE=2]cMonth = [/SIZE][SIZE=2][COLOR=#cd3a3a]INTEGER[/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#7f0055]SUBSTRING[/COLOR][/SIZE][SIZE=2](szValidUntil,[/SIZE][SIZE=2][COLOR=#2a00ff]5[/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#2a00ff]2[/COLOR][/SIZE][SIZE=2])).[/SIZE]
[SIZE=2]cDay = [/SIZE][SIZE=2][COLOR=#cd3a3a]INTEGER[/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#7f0055]SUBSTRING[/COLOR][/SIZE][SIZE=2](szValidUntil,[/SIZE][SIZE=2][COLOR=#2a00ff]7[/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#2a00ff]2[/COLOR][/SIZE][SIZE=2])).[/SIZE]
[SIZE=2]ddDate = [/SIZE][SIZE=2][COLOR=#cd3a3a]DATE[/COLOR][/SIZE][SIZE=2](cMonth,cDay,cYear).[/SIZE]
 
 
[LEFT][SIZE=2][COLOR=#7f0055]MESSAGE [/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff]"IBAN-Tool (Windows-Dll):"[/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]SKIP[/COLOR][/SIZE][/LEFT]
[SIZE=2][COLOR=#2a00ff]"Version: " [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]STRING[/COLOR][/SIZE][SIZE=2](idwMajor1) + [/SIZE][SIZE=2][COLOR=#2a00ff]"."[/COLOR][/SIZE][SIZE=2] + [/SIZE][SIZE=2][COLOR=#7f0055]STRING[/COLOR][/SIZE][SIZE=2](idwMajor1) + [/SIZE][SIZE=2][COLOR=#2a00ff]"."[/COLOR][/SIZE][SIZE=2] + [/SIZE][SIZE=2][COLOR=#7f0055]STRING[/COLOR][/SIZE][SIZE=2](idwMinor1) + [/SIZE][SIZE=2][COLOR=#2a00ff]"."[/COLOR][/SIZE][SIZE=2] + [/SIZE][SIZE=2][COLOR=#7f0055]STRING[/COLOR][/SIZE][SIZE=2](idwMinor2) [/SIZE][SIZE=2][COLOR=#7f0055]SKIP[/COLOR][/SIZE]
[SIZE=2][COLOR=#2a00ff]"Valable jusqu''au :" [/COLOR][/SIZE][SIZE=2]ddDate[/SIZE]
[SIZE=2][COLOR=#7f0055]VIEW-AS [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]ALERT-BOX [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]INFO [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]BUTTONS [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]OK[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]TITLE [/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff]"IBAN Test"[/COLOR][/SIZE][SIZE=2].[/SIZE]
[SIZE=2][COLOR=#7f0055]END.[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]/*on error*/[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]ELSE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]DO[/COLOR][/SIZE][SIZE=2]:[/SIZE]
[SIZE=2][COLOR=#7f0055]MESSAGE [/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff]"La version ne peut pas être déterminée"[/COLOR][/SIZE][SIZE=2] iResult[/SIZE]
[SIZE=2][COLOR=#7f0055]VIEW-AS [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]ALERT-BOX [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]ERROR [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]BUTTONS [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]OK.[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]END.[/COLOR][/SIZE]
 
[LEFT][SIZE=2][COLOR=#3f7f5f]/*reinitialise*/[/COLOR][/SIZE][/LEFT]
[SIZE=2][COLOR=#7f0055]SET-SIZE [/COLOR][/SIZE][SIZE=2](pdwMajor) = [/SIZE][SIZE=2][COLOR=#2a00ff]0[/COLOR][/SIZE][SIZE=2].[/SIZE]
[SIZE=2][COLOR=#7f0055]SET-SIZE [/COLOR][/SIZE][SIZE=2](pdwMinor) = [/SIZE][SIZE=2][COLOR=#2a00ff]0[/COLOR][/SIZE][SIZE=2].[/SIZE]
[SIZE=2][COLOR=#7f0055]SET-SIZE [/COLOR][/SIZE][SIZE=2](pszValidUntil) = [/SIZE][SIZE=2][COLOR=#2a00ff]0[/COLOR][/SIZE][SIZE=2].[/SIZE]
[SIZE=2][COLOR=#3f7f5f]/* at the end release external DLL */[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]RELEASE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]EXTERNAL[/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff]"{&IBANKERNEL_DLL}"[/COLOR][/SIZE][SIZE=2]:U.[/SIZE]
[SIZE=2][COLOR=#7f0055]RETURN.[/COLOR][/SIZE]
 
[SIZE=2][COLOR=#3f7f5f]/*definition de la procedure*/[/COLOR][/SIZE]

[LEFT]
[SIZE=2][COLOR=#3f7f5f]/*declaration de la methode d'appel CDECL de la dll*/[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]PROCEDURE [/COLOR][/SIZE][SIZE=2]IT_IBANVersion [/SIZE][SIZE=2][COLOR=#7f0055]EXTERNAL[/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff]"{&IBANKERNEL_DLL}"[/COLOR][/SIZE][SIZE=2]:U [/SIZE][SIZE=2][COLOR=#7f0055]CDECL P[/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]ERSISTENT[/COLOR][/SIZE][SIZE=2]: [/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]INPUT [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]PARAMETER[/COLOR][/SIZE][SIZE=2] dwMajor [/SIZE][SIZE=2][COLOR=#7f0055]AS[/COLOR][/SIZE][SIZE=2][COLOR=#cd3a3a]MEMPTR.[/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f]/*pointer pour la version majeur*/[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]INPUT [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]PARAMETER[/COLOR][/SIZE][SIZE=2] dwMinor [/SIZE][SIZE=2][COLOR=#7f0055]AS[/COLOR][/SIZE][SIZE=2][COLOR=#cd3a3a]MEMPTR.[/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f]/*pointer pour la version mineur*/[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]INPUT [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]PARAMETER[/COLOR][/SIZE][SIZE=2] pszValidUntil [/SIZE][SIZE=2][COLOR=#7f0055]AS[/COLOR][/SIZE][SIZE=2][COLOR=#cd3a3a]MEMPTR.[/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f]/*pointer pour la date*/[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]INPUT [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]PARAMETER[/COLOR][/SIZE][SIZE=2] nValidLen [/SIZE][SIZE=2][COLOR=#7f0055]AS[/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]LONG.[/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f]/*buffer la taille de la date*/[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]DEFINE [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]RETURN [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]PARAMETER[/COLOR][/SIZE][SIZE=2] infoResult [/SIZE][SIZE=2][COLOR=#7f0055]AS[/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]LONG.[/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f]/*reponse 0=erreur, la version ne peut pas etre determinée*/[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]END [/COLOR][/SIZE][SIZE=2][COLOR=#7f0055]PROCEDURE.[/COLOR][/SIZE]
[/LEFT]
 

xxxcapxxx

New Member
You can leave the version and try to do a conversion. There is a pdf with a sample, check that you receive the same result.

Daniel

I am trying to guess one thing out about the conversion function inside the dll
wich parameters shall i use to give the clearing n° and account n° , as all the way i tried just gave me again the parameter thing error , or made the runtime crash.
any idea ?
 

DelphiJohn

New Member
Hi,

I have problem to work with the same DLL under Delphi. I receive a returncode and no error message but also no resultvalue. Can everyone help me?

My Code:

procedure TForm1.Button1Click(Sender: TObject);
type
{TIBANProc = function(d: integer; var c: PChar; b: PChar; a: PChar): integer; stdcall;}
TIBANProc = function(a: PChar; b: PChar; var c: PChar; d: integer): integer; stdcall;

var
hDLL: THandle; // Handle zur DLL
iRes: integer; // Ergebnis der Funktion
FarProc: TIBANProc;
sDLLPath: PAnsiChar;
a,b: pChar;
c: pChar;
d: integer;
begin
sDLLPath := PChar(ExtractFilePath(Application.ExeName) + 'IBANKernel.dll');
hDLL := LoadLibrary(sDLLPath);
if hDLL = 0 then begin
ShowMessage('DLL konnte nicht geladen werden.');
Exit;
end;

try
a := pChar('415811.00032');
b := pChar('100');
c := pChar('xy');
d := 21;
iRes := 0;
@FarProc := GetProcAddress(hDLL, 'IT_IBANConvert');
if Assigned(@FarProc) then
iRes := FarProc(a,b,c,d);
ShowMessage('Bingo-->'+a+'-->'+b+'-->'+c+'------->'+IntToStr(iRes));

FreeLibrary(hDLL);
except
ShowMessage('Funktion der DLL konnte nicht ausgeführt werden.');
end;
end;
 

xxxcapxxx

New Member
did you check on that : http://www.sic.ch/de/dl_ibantool_fi_swh.pdf

you can found this on page 41

Code:
Anwendungsbeispiel: Aufruf aus C#:
[DllImport("IBANKernel.dll")]
static extern int IT_IBANConvert( String sKonto,
String sBCPC,
StringBuilder lpszIBAN,
int nIBANLen,
StringBuilder lpszBC,
int nBCLen,
StringBuilder lpszPC,
int nPCLen,
StringBuilder lpszRESERVED,
int nRESERVEDLen);
int nResult = 0;
StringBuilder sbIBAN = new StringBuilder(64);
StringBuilder sbBC = new StringBuilder(32);
StringBuilder sbPC = new StringBuilder(32);
StringBuilder sbRES = new StringBuilder(32);

when i used to code in delphi i could get lot of comprehension by looking at c# and vb code.
 

DelphiJohn

New Member
The problem was i haven't found an example in Delphi and C# is near the same but not exactly the same.
Anyway it works now with this code:

procedure TForm1.Button1Click(Sender: TObject);
type
TIBANProc = function(
pszKonto: PChar;
pszBCPC: PChar;
pszIBAN: PChar;
nIBANLen: Integer;
pszBC: pChar;
nBCLen: Integer;
pszPC: pChar;
nPCLen: Integer;
pszBIC: pChar;
nBICLen: Integer
): Integer; cdecl;

var
hDLL: THandle; // Handle zur DLL
iRes: integer; // Ergebnis der Funktion
FarProc: TIBANProc;
sDLLPath: PAnsiChar;
pszKonto,pszBCPC,pszIBAN,pszBC,pszPC,pszBIC: pChar;
nIBANLen,nBCLen,nPCLen,nBICLen: integer;
begin
sDLLPath := PChar(ExtractFilePath(Application.ExeName) + 'IBANKernel.dll');
hDLL := LoadLibrary(sDLLPath);
if hDLL = 0 then begin
ShowMessage('DLL konnte nicht geladen werden.');
Exit;
end;

try
pszKonto := pChar(edit2.Text);
pszBCPC := pChar(edit1.Text);
pszIBAN := nil;pszIBAN := StrAlloc(20);
nIBANLen := 21;
pszBC := nil;pszBC := StrAlloc(20);
nBCLen := 10;
pszPC := pChar('100');pszPC := StrAlloc(20);
nPCLen := 10;
pszBIC := nil;pszBIC := StrAlloc(20);
nBICLen := 10;
iRes := 0;
@FarProc := GetProcAddress(hDLL, 'IT_IBANConvert');
if Assigned(@FarProc) then
begin
iRes := FarProc(pszKonto,pszBCPC,pszIBAN,nIBANLen,pszBC,nBCLen,pszPC,nPCLen,pszBIC,nBICLen);
edit3.Text := pszPC;
edit4.Text := pszIBAN;
edit5.Text := IntToStr(iRes);
end;
FreeLibrary(hDLL);
except
ShowMessage('Funktion der DLL konnte nicht ausgeführt werden.');
end;
end;

Thanks for your help!!
 

xxxcapxxx

New Member
Just one more thing , about your error message, the dll returns about 30 different message.

I may be good to use them ;) you can also found the list of possible return in the .pdf if I remember well.
 
Top