Answer the question
In order to leave comments, you need to log in
How should this C function look like in Delphi?
Hello everyone,
there is a Delphi program that calls a DLL from Sberbank. One of the Sber functions uses a callback, which is not clear how to correctly translate it into Delphi.
Function: __declspec(dllexport) int SetGUIHandles(int hwndText, int hwndEdit)
Further quote from the documentation -
If you set the second parameter of the SetGUIHandles() function to 0, then the first one will be interpreted as the address of the callback function for displaying messages. The callback function should look like this (Borland C++ Builder example):
#define ICMD_DISP_STRING_1 1
#define ICMD_DISP_STRING_2 2
int HalDispFunc(int cmd, char* par1, int par2)
{
char buf2[256];
buf2[0] = 0;
if(par1)
strcpy(buf2, par1);
switch(cmd){
case ICMD_DISP_STRING_1:
if(par2 <= 3)
Form1->StaticText1->Caption = buf2;
else
Form1->StaticText3->Caption = buf2;
break;
....
return 0;
}
Answer the question
In order to leave comments, you need to log in
Function declaration:
function SetGUIHandles(HWndText: Integer; HWndEdit: Integer): Integer; stdcall; external 'Имя DLL';
function HalDispFunc(Cmd: Integer; Par1: Pointer; Par2: Integer): Integer; stdcall;
SetGUIHandles(Integer(@HalDispFunc), 0);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question