GetErrorMessages Method - intrepidcs API
C/C++ declare - VB declare - VB.NET declare - C# declare -Parameters - Return Value - Remarks - C/C++ example - VB example - VB.NET example - C# example

This method reads the neoVI DLL error message queue.

C/C++ Declare

int _stdcall icsneoGetErrorMessages(int hObject, int *pErrorMsgs, int *pNumberOfErrors);

Visual Basic Declare

Public
Declare Function icsneoGetErrorMessages Lib "icsneo40.dll" (ByVal hObject As Long, ByRef pErrorMsgs As Long, ByRef pNumberOfErrors As Long) As Long


Visual Basic .NET Declare

Public Declare Function icsneoGetErrorMessages Lib "icsneo40.dll" (ByVal hObject As Int32, ByRef pErrorMsgs As Int32, ByRef pNumberOfErrors As Int32) As Int32


C#  Declare

[DllImport("icsneo40.dll")]
public static extern Int32 icsneoGetErrorMessages(Int32 hObject, ref Int32 pErrorMsgs, ref
Int32 pNumberOfErrors);


Parameters

hObject
    [in] Specifies the driver object created with OpenNeoDevice.

pErrorMsgs
    [out] This is the address of the first element of an array of long variables of at least 600 elements. This array will be loaded with the current error queue. The error queue will contain errors generated by all threads, not just the current thread. A separate topic describes the possible values for error messages. You can get a text description of this error using GetErrorInfo.

pNumberOfErrors
    [out] Specifies the number of errors copied into the pErrorMsgs buffer. The maximum value will be 600.

 Return Values

Returns 1 if successful, 0 on failure.

Remarks

The error queue will be reset after this method is called.


Examples

Visual Basic Example

'// Declared at form level
Private m_hObject As Long '// Holds the object for the state of the application

Dim lResult As Long
Dim lErrors(0 to 599) As Long
Dim lNumberOfErrors As Long

'// Read Out the errors
lResult =
icsneoGetErrorMessages(m_hObject, lErrors(0), lNumberOfErrors)
'// Test the returned result
If Not CBool(lResult) Then
    MsgBox "Problem Reading Errors"
End If

C/C++ Example

int hObject = 0; // holds a handle to the neoVI object

int iErrors[599];
int lResult;
int lNumberOfErrors;
TCHAR szOut[200];
long lCount;

// Read the errors from the DLL
lResult = icsneoGetErrorMessages(hObject,iErrors,&lNumberOfErrors);
if (lResult == 0)
    MessageBox(hWnd,TEXT("Problem Reading errors"),TEXT("neoVI Example"),0);

// dump the neoVI errors to the debug window
if(lNumberOfErrors > 0)
{
    for(lCount=0;lCount <lNumberOfErrors; lCount++)
    {
        wsprintf(szOut,TEXT("Error %d\n"),iErrors[lCount]);
        OutputDebugString(szOut);
    }
}
else
    OutputDebugString(TEXT("No Errors to report\n"));

Visual Basic .NET Example

Dim lResult As Integer '//Storage for result of Function Call
Dim lErrors(600) As Integer '//Array for Error information
Dim lNumberOfErrors As Integer '//Storage for Number of Errors

'// Read Out the errors

lResult = icsneoGetErrorMessages(m_hObject, lErrors(0), lNumberOfErrors)

'// Test the returned result
If Not CBool(lResult) Then
    MsgBox("Problem Reading Errors")
End
If

C# Example

int iResult = 0; //Storage for Result of Call
int[] iErrors = new int[600]; //Array for Error Numbers
int iNumberOfErrors = 0; // Storage for number of errors

// Read Out the errors

iResult = icsNeoDll.icsneoGetErrorMessages(m_hObject,
ref iErrors[0],ref
iNumberOfErrors);


intrepidcs API Documentation - (C) Copyright 2000-2009 Intrepid Control Systems, Inc.  (www.intrepidcs.com)

Last Updated : Wednesday, December 17, 2008