GetMessages Method - neoVI API

int _stdcall icsneoGetMessages(void * hObject, icsSpyMessage *pMsg, int *pNumberOfMessages, int *pNumberOfErrors);



[in] Specifies the driver object created by OpenNeoDevice.


[out] This is the address of the first element of an array of icsSpyMessage structures. This array will be loaded with messages received by the hardware. This array must be sized to fit 20,000 icsSpyMessage structures.


[out] Specifies the number of messages the driver has loaded in the pMsg array. This number can be up to 20,000 messages.


[out] Specifies the number of errors in the neoVI DLL error queue. Errors are obtained using GetErrorMessages.

Return Values

Returns 1 if successful, 0 if an error occurred. GetLastAPIError must be called to obtain the specific error. This function will return 1 even if no messages were received, provided there are no errors. The errors that can be generated by this function are:



The driver object will hold 20,000 received messages before it will generate an rx buffer overflow error (indicated by a NEOVI_ERROR_DLL_RX_MSG_BUFFER_OVERFLOW error message in the error queue). It is the job of the application software to read this buffer at regular intervals. The rate that the application needs to read these messages is dependant on the rate messages are received on the bus. For example, a high bandwidth CAN bus can generate 5000 messages per second. In this case you must read out the messages at least every four seconds or overflow errors will result.


void * hObject = 0;                 // holds a handle to the neoVI object
icsSpyMessage stMessages[20000]; // holds the received messages
int iResult;
int iNumberOfErrors;
int iNumberOfMessages;

// read out the messages
iResult = icsneoGetMessages(hObject,stMessages,&iNumberOfMessages,&iNumberOfErrors);
if (iResult == 0)
    MessageBox(hWnd,TEXT("Problem Reading Messages"),TEXT("neoVI Example"),0);
    MessageBox(hWnd, TEXT("Messages Read Successfully"),TEXT("neoVI Example"),0);

Last updated