Hello,
i need help to translate the c code to autoit .
I don't understand the callback function.
#include <windows.h>
#include <stdio.h>
// native IR Data by PAnsiChar
typedef void CALLBACK CallBackPAnsiChar(char*, char*, char*, char*);
typedef int (__stdcall *impInitPAnsiChar)(CallBackPAnsiChar);
CALLBACK MyCallBackPAnsiChar(char* Protocol, char* Address, char* Command, char* Flags)
{
printf("\nIR Data received: Protocol: %s, Address: 0x%s, Command: 0x%s, Flags: 0x%s", Protocol, Address, Command, Flags);
fflush(stdout);
}
int main(int argc, char **argv)
{
impInitPAnsiChar InitPAnsiChar = NULL;
// Load DLL file
HINSTANCE hinstLib = LoadLibrary(TEXT("USB_IR_Remote_Receiver.dll"));
if (hinstLib == NULL) {
printf("\nERROR: unable to load DLL\n");
return 1;
}
// Get function pointer InitPAnsiChar
InitPAnsiChar = (impInitPAnsiChar)GetProcAddress(hinstLib, "InitPAnsiChar");
if (InitPAnsiChar == NULL) {
printf("\nERROR: unable to find DLL function\n");
FreeLibrary(hinstLib);
return 1;
}
if (InitPAnsiChar(*MyCallBackPAnsiChar))
{
printf("\nInit DLL with InitPAnsiChar successfull");
}
else
{
// Unload DLL file
FreeLibrary(hinstLib);
return 0;
}
while(1)
{
}
//return 0;
}