#define NO_OF_GRABBER_GROUPS 6 int SearchBoards() { HKEY hKey; HMODULE hDll; DWORD dwBufLength; TmvGetBoardInfo mvGetBoardInfo; INFO_T boardInfo; int boardNumber; int boardCountOverall = 1; int returnValue; static char* RegPath[NO_OF_GRABBER_GROUPS] = { {"SOFTWARE\\MATRIX Vision\\FG Driver\\MVTITAN"}, {"SOFTWARE\\MATRIX Vision\\FG Driver\\MVSDIG32"}, {"SOFTWARE\\MATRIX Vision\\FG Driver\\MVSC32"}, {"SOFTWARE\\MATRIX Vision\\FG Driver\\MVSG32"}, {"SOFTWARE\\MATRIX Vision\\FG Driver\\MVSRGB32"}, {"SOFTWARE\\MATRIX Vision\\FG Driver\\MVSL32"} }; unsigned char *szDllPath; szDllPath = (unsigned char*)calloc(1, 255); unsigned char *versionString; versionString = (unsigned char*)calloc(1, 255); printf( "List of all MATRIX VISION Boards installed on this machine:\n" ); printf( "-------------------------------------------------------------------------------------\n" ); for( int i=0; i < NO_OF_GRABBER_GROUPS; i++ ) { if( RegOpenKey( HKEY_LOCAL_MACHINE, RegPath[i], &hKey ) == ERROR_SUCCESS ) { if( RegQueryValueEx( hKey, "ImagePath", 0, 0, szDllPath, &dwBufLength) == ERROR_SUCCESS ) { hDll = LoadLibrary((const char*)szDllPath); GetDriverDLLVersion((char*)szDllPath, (char*)versionString); if( hDll ) { mvGetBoardInfo = (TmvGetBoardInfo) GetProcAddress( hDll, (LPCSTR)"mvGetBoardInfo"); if( mvGetBoardInfo ) { boardNumber = 0; while( ( returnValue = mvGetBoardInfo( boardNumber, &boardInfo ) ) > 0 ) { cout << "Board Number: " << boardCountOverall++ << endl << "-------------------------------------" << endl << "BOARD TYPE:\t\t" << boardInfo.BoardType << endl << "HARDWARE REV.:\t\t" << boardInfo.Revision << endl << "SERIAL:\t\t\t" << boardInfo.SerialNumber << endl << "BRIDGE/SLOT:\t\t" << ( ( returnValue >> 8) & 0xff ) << "/" << ( returnValue & 0xff ) << endl << "DRIVER-DLL:\t\t" << szDllPath << endl << "DRIVER-REVISION:\t" << versionString << endl << endl << "to open this board with 'newgrabber' or 'SelBoard' in ini-files use boardnumber " << boardNumber << "\nand the DLL-name without the path information." << endl << "-------------------------------------------------------------------------------------\n\n"; boardNumber++; } } FreeLibrary(hDll); mvGetBoardInfo = NULL; } else if( !hDll ) printf( "\n\tFailed to load the following DLL: %s\n", szDllPath ); } else printf( "\n\tFailed to query Registry value.\n\t\tKEY: HKEY_LOCAL_MACHINE\\%s\n\t\tVALUE: ImagePath Error %d\n", RegPath[i], GetLastError() ); } else printf( "\n\tRegistry key could not be opened. The following driver is not installed on the system:\n\t\tHKEY_LOCAL_MACHINE\\%s\n", RegPath[i] ); RegCloseKey( hKey); } free(szDllPath); free(versionString); return _resContinue; }