[quote="hirnstroem"]
int setReceiveCallBack( CANHANDLE h, LPFNDLL_RECEIVE_CALLBACK cbfn )
void fn( CANMsg *pMsg );
Delphi-Quellcode:
type TCallBackEvent : procedure(var MsgBuf: CANMsg);
var Callback : TCallBackEvent;
function canusb_setReceiveCallBack(h: DWord; LPFNDLL_RECEIVE_CALLBACK: TCallBackEvent) : CANUSB_Result; stdcall ; External 'canusbdrv.dll' name 'canusb_setReceiveCallBack';
procedure OnReceiveMessage(var MsgBuf: CANMsg);
Begin
//Do something
end;
Procedure TMyprogram.INIT;
Begin
Callback := OnReceiveMessage;
canusb_setReceiveCallBack(h,Callback); // @OnReceivemessage geht vermutlich auch, aber
// ich hab sowas immer über Proceduraletypen gemacht.
end;