42 DWORD dw = GetLastError();
45 FORMAT_MESSAGE_ALLOCATE_BUFFER |
46 FORMAT_MESSAGE_FROM_SYSTEM |
47 FORMAT_MESSAGE_IGNORE_INSERTS,
50 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
55 lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT,
56 (lstrlen((LPCTSTR)lpMsgBuf) + lstrlen((LPCTSTR)lpszFunction) + 40) *
sizeof(TCHAR));
57 StringCchPrintf((LPTSTR)lpDisplayBuf,
58 LocalSize(lpDisplayBuf) /
sizeof(TCHAR),
59 TEXT(
"%s failed with error %d: %s"),
60 lpszFunction, dw, lpMsgBuf);
61 MessageBox(NULL, (LPCTSTR)lpDisplayBuf, TEXT(
"Error"), MB_OK);
64 LocalFree(lpDisplayBuf);
90 std::ostringstream ss;
91 ss << libName <<
"can.dll";
96 LOG(
Log::DBG,
lh) <<
"Proceeding to ExA load library " << ss.str();
101 LOG(
Log::DBG,
lh) <<
" loaded the dynamic library: [" << ss.str() <<
"]";
103 string msg =
string(__FUNCTION__) +
string(
"Error: could not load the dynamic library ") + ss.str();
105 if ( ss.str() ==
"ancan.dll"){
106 LOG(
Log::ERR,
lh) <<
" WARNING: anagate vendor libs do not install on your system, they are just copied. Make sure the hidden dependend libs (i.e. AnaGateCan64.dll) are in your lib search path!";
107 LOG(
Log::ERR,
lh) <<
" WARNING: easiest solution: copy them into the same directory as the CANX-tester binary";
110 throw std::runtime_error( msg.c_str() );
122 LOG(
Log::TRC,
lh) << __FUNCTION__ <<
": Accessing method get getCanBusAccess";
123 f_CCanAccess *canAccess = (f_CCanAccess *)GetProcAddress(
m_pDynamicLibrary,
"getCanBusAccess");
125 std::cout << __FILE__ <<
" " << __LINE__ <<
" " << __LINE__ <<
" CanAccess= 0x" << canAccess << std::endl;
130 throw std::runtime_error(
string(__FUNCTION__) +
string(
": Error: could not locate the function"));
133 LOG(
Log::TRC,
lh) << __FUNCTION__ <<
": getCanBusAccess: got an object ptr from library, OK";