FEDRA emulsion software from the OPERA Collaboration
CSerialException Class Reference

#include <serialport.h>

Inheritance diagram for CSerialException:
Collaboration diagram for CSerialException:

Public Member Functions

 CSerialException (DWORD dwError)
 
CString GetErrorMessage ()
 
virtual BOOL GetErrorMessage (LPTSTR lpstrError, UINT nMaxError, PUINT pnHelpContext=NULL)
 
 ~CSerialException ()
 

Public Attributes

DWORD m_dwError
 

Constructor & Destructor Documentation

◆ CSerialException()

CSerialException::CSerialException ( DWORD  dwError)
131 {
132  m_dwError = dwError;
133 }
DWORD m_dwError
Definition: serialport.h:46

◆ ~CSerialException()

CSerialException::~CSerialException ( )
136 {
137 }

Member Function Documentation

◆ GetErrorMessage() [1/2]

CString CSerialException::GetErrorMessage ( )
122 {
123  CString rVal;
124  LPTSTR pstrError = rVal.GetBuffer(4096);
125  GetErrorMessage(pstrError, 4096, NULL);
126  rVal.ReleaseBuffer();
127  return rVal;
128 }
CString GetErrorMessage()
Definition: serialport.cpp:121
#define NULL
Definition: nidaqmx.h:84

◆ GetErrorMessage() [2/2]

BOOL CSerialException::GetErrorMessage ( LPTSTR  lpstrError,
UINT  nMaxError,
PUINT  pnHelpContext = NULL 
)
virtual
97 {
98  ASSERT(pstrError != NULL && AfxIsValidString(pstrError, nMaxError));
99 
100  if (pnHelpContext != NULL)
101  *pnHelpContext = 0;
102 
103  LPTSTR lpBuffer;
104  BOOL bRet = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
105  NULL, m_dwError, MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT),
106  (LPTSTR) &lpBuffer, 0, NULL);
107 
108  if (bRet == FALSE)
109  *pstrError = '\0';
110  else
111  {
112  lstrcpyn(pstrError, lpBuffer, nMaxError);
113  bRet = TRUE;
114 
115  LocalFree(lpBuffer);
116  }
117 
118  return bRet;
119 }
#define TRUE
Definition: nidaqmx.h:78
#define FALSE
Definition: nidaqmx.h:81

Member Data Documentation

◆ m_dwError

DWORD CSerialException::m_dwError

The documentation for this class was generated from the following files: