Home > Back-end >  C # to Delphi hai kang alarm callback function, really don't understand, c #,
C # to Delphi hai kang alarm callback function, really don't understand, c #,

Time:02-26

Void CALLBACK MessageCallback (LONG lCommand, NET_DVR_ALARMER * pAlarmer, char * pAlarmInfo, dwords dwBufLen, void * pUser)
{
int i;
The switch (lCommand)
{
Case COMM_ALARM:
{
NET_DVR_ALARMINFO struAlarmInfo;
Memcpy (& amp; StruAlarmInfo pAlarmInfo, sizeof (NET_DVR_ALARMINFO));
The switch (struAlarmInfo dwAlarmType)
{
Case 3://motion detecting alarm
For (I=0; I<16. I++)//# define MAX_CHANNUM 16//the number of translating
{
If (struAlarmInfo dwChannel [I]==1)
{
Printf (" move detection alarm channel number % d \ n ", I + 1);
}
}
break;
Default:
break;
}
}
break;
Default:
break;
}
}

CodePudding user response:

Delphi no CALLBACK modifier, but can use procedural type (procedural types) to transform,
http://docwiki.embarcadero.com/RADStudio/Sydney/en/Procedural_Types_ (Delphi)

CodePudding user response:

A CALLBACK is a macro, is __stdcall, namely the Delphi stdcall
And the building should be C code, not C # code, C # can't write a global function

CodePudding user response:

C # write a callback function with static public modified