//************************************************************* // // LoadMruInReg() // // Purpose: // Load MRU from the registry // // Parameters: // LPMRUMENU lpMruMenu - pointer on MRUMENU // LPSTR lpszKey - Points to a null-terminated string // specifying the name of a key that // this function opens or creates. // // Return: (bool) // true - Function run successfully // false - Function don't run successfully // // // Comments: // Win32 function designed for Windows NT and Windows 95 // See RegOpenKeyEx API for more info on lpszKey // // History: Date Author Comment // 09/24/94 G. Vollant Created // //************************************************************* bool LoadMruInReg(LPMRUMENU lpMruMenu,LPCSTR lpszKey) { LPSTR lpTxt; WORD i; HKEY hCurKey; DWORD dwType; lpTxt = new char [lpMruMenu->wMaxSizeLruItem + 20]; if (lpTxt == NULL) return false; RegOpenKeyEx (HKEY_CURRENT_USER, lpszKey, 0, KEY_READ, &hCurKey); for (i = 0; i < lpMruMenu->wNbLruMenu; i++) { char szEntry[16]; DWORD dwSizeBuf; wsprintf(szEntry, "File%lu", (DWORD)i+1); *lpTxt = '\0'; dwSizeBuf = lpMruMenu->wMaxSizeLruItem + 10; RegQueryValueEx (hCurKey, szEntry, NULL, &dwType, (LPBYTE)lpTxt, &dwSizeBuf); *(lpTxt+dwSizeBuf) = '\0'; if (*lpTxt == '\0') break; SetMenuItem(lpMruMenu,i,lpTxt); } RegCloseKey(hCurKey); delete lpTxt; return true; }
//************************************************************* // // LoadMruInReg() // // Purpose: // Load MRU from the registry // // Parameters: // LPMRUMENU lpMruMenu - pointer on MRUMENU // LPSTR lpszKey - Points to a null-terminated string // specifying the name of a key that // this function opens or creates. // // Return: (BOOL) // TRUE - Function run successfully // FALSE - Function don't run successfully // // // Comments: // Win32 function designed for Windows NT and Windows 95 // See RegOpenKeyEx API for more info on lpszKey // // History: Date Author Comment // 09/24/94 G. Vollant Created // //************************************************************* BOOL LoadMruInReg( LPMRUMENU lpMruMenu, LPSTR lpszKey ) { LPSTR lpTxt; WORD i; HKEY hCurKey; DWORD dwType; lpTxt = ( LPSTR )GlobalAllocPtr( GHND, lpMruMenu->wMaxSizeLruItem + 20 ); if ( lpTxt == NULL ) return FALSE; RegOpenKeyEx( HKEY_CURRENT_USER, lpszKey, 0, KEY_READ, &hCurKey ); for ( i = 0; i < lpMruMenu->wNbLruMenu; i++ ) { char szEntry[16]; DWORD dwSizeBuf; wsprintf( szEntry, "File%lu", ( DWORD )i + 1 ); *lpTxt = '\0'; dwSizeBuf = lpMruMenu->wMaxSizeLruItem + 10; RegQueryValueEx( hCurKey, szEntry, NULL, &dwType, ( LPBYTE )lpTxt, &dwSizeBuf ); *( lpTxt + dwSizeBuf ) = '\0'; if ( *lpTxt == '\0' ) break; SetMenuItem( lpMruMenu, i, lpTxt ); } RegCloseKey( hCurKey ); GlobalFreePtr( lpTxt ); return TRUE; }
//************************************************************* // // LoadMruInIni() // // Purpose: // Load MRU from a private .INI // // Parameters: // LPMRUMENU lpMruMenu - pointer on MRUMENU // LPSTR lpszSection - Points to a null-terminated string containing // the name of the section // LPSTR lpszFile - Points to a null-terminated string that names // the initialization file. // // Return: (BOOL) // true - Function run successfully // false - Function don't run successfully // // // Comments: // See GetPrivateProfileString API for more info on lpszSection and lpszFile // // History: Date Author Comment // 09/24/94 G. Vollant Created // //************************************************************* BOOL LoadMruInIni(LPMRUMENU lpMruMenu,LPCSTR lpszSection,LPCSTR lpszFile) { if (!lpMruMenu -> fEmpty) return true; // nur einmal einlesen LPSTR lpTxt; lpTxt = new char [lpMruMenu->wMaxSizeLruItem + 20]; if (lpTxt == NULL) return false; for (WORD i = 0; i< lpMruMenu->wNbLruMenu; i++) { char szEntry[16]; wsprintf(szEntry, "File%lu", (DWORD)i+1); GetPrivateProfileString(lpszSection,szEntry,"",lpTxt, lpMruMenu->wMaxSizeLruItem + 10,lpszFile); if (*lpTxt == '\0') break; char *pT = strchr (lpTxt, ','); if (pT) *pT = '\0'; // fRO abkoppeln BOOL fRO = pT ? ('0' == *(pT+1) ? false : true) : false; SetMenuItem (lpMruMenu, i, lpTxt, fRO); } delete lpTxt; lpMruMenu -> fEmpty = false; return true; }
//************************************************************* // // LoadMruInReg() // // Purpose: // Load MRU from the registry // // Parameters: // LPMRUMENU lpMruMenu - pointer on MRUMENU // LPSTR lpszKey - Points to a null-terminated string // specifying the name of a key that // this function opens or creates. // // Return: (BOOL) // true - Function run successfully // false - Function don't run successfully // // // Comments: // Win32 function designed for Windows NT and Windows 95 // See RegOpenKeyEx API for more info on lpszKey // // History: Date Author Comment // 09/24/94 G. Vollant Created // //************************************************************* BOOL LoadMruInReg(LPMRUMENU lpMruMenu,LPCSTR lpszKey) { if (!lpMruMenu -> fEmpty) return true; // nur einmal einlesen LPSTR lpTxt; WORD i; HKEY hCurKey; DWORD dwType; lpTxt = new char [lpMruMenu->wMaxSizeLruItem + 20]; if (lpTxt == NULL) return false; RegOpenKeyEx (HKEY_CURRENT_USER, lpszKey, 0, KEY_READ, &hCurKey); for (i = 0; i < lpMruMenu->wNbLruMenu; i++) { char szEntry[16]; DWORD dwSizeBuf; wsprintf(szEntry, "File%lu", (DWORD)i+1); *lpTxt = '\0'; dwSizeBuf = lpMruMenu->wMaxSizeLruItem + 10; if (ERROR_SUCCESS == RegQueryValueEx (hCurKey, szEntry, NULL, &dwType, (LPBYTE)lpTxt, &dwSizeBuf)) *(lpTxt+dwSizeBuf) = '\0'; if (*lpTxt == '\0') break; char *pT = strchr (lpTxt, ','); if (pT) *pT = '\0'; BOOL fRO = pT ? ('0' == *(pT+1) ? false : true) : false; SetMenuItem(lpMruMenu,i,lpTxt, fRO); } RegCloseKey(hCurKey); delete lpTxt; lpMruMenu -> fEmpty = false; return true; }
//************************************************************* // // LoadMruInIni() // // Purpose: // Load MRU from a private .INI // // Parameters: // LPMRUMENU lpMruMenu - pointer on MRUMENU // LPSTR lpszSection - Points to a null-terminated string containing // the name of the section // LPSTR lpszFile - Points to a null-terminated string that names // the initialization file. // // Return: (BOOL) // TRUE - Function run successfully // FALSE - Function don't run successfully // // // Comments: // See GetPrivateProfileString API for more info on lpszSection and lpszFile // // History: Date Author Comment // 09/24/94 G. Vollant Created // //************************************************************* BOOL LoadMruInIni( LPMRUMENU lpMruMenu, LPSTR lpszSection, LPSTR lpszFile ) { LPSTR lpTxt; WORD i; lpTxt = ( LPSTR )GlobalAllocPtr( GHND, lpMruMenu->wMaxSizeLruItem + 20 ); if( lpTxt == NULL ) { return FALSE; } for( i = 0; i < lpMruMenu->wNbLruMenu; i++ ) { char szEntry[16]; wsprintf( szEntry, "File%lu", ( DWORD )i + 1 ); GetPrivateProfileString( lpszSection, szEntry, "", lpTxt, lpMruMenu->wMaxSizeLruItem + 10, lpszFile ); if( *lpTxt == '\0' ) { break; } SetMenuItem( lpMruMenu, i, lpTxt ); } GlobalFreePtr( lpTxt ); return TRUE; }
//************************************************************* // // LoadMruInIni() // // Purpose: // Load MRU from a private .INI // // Parameters: // LPMRUMENU lpMruMenu - pointer on MRUMENU // LPSTR lpszSection - Points to a null-terminated string containing // the name of the section // LPSTR lpszFile - Points to a null-terminated string that names // the initialization file. // // Return: (bool) // true - Function run successfully // false - Function don't run successfully // // // Comments: // See GetPrivateProfileString API for more info on lpszSection and lpszFile // // History: Date Author Comment // 09/24/94 G. Vollant Created // //************************************************************* bool LoadMruInIni(LPMRUMENU lpMruMenu,LPCSTR lpszSection,LPCSTR lpszFile) { LPSTR lpTxt; WORD i; lpTxt = new char [lpMruMenu->wMaxSizeLruItem + 20]; if (lpTxt == NULL) return false; for (i = 0; i< lpMruMenu->wNbLruMenu; i++) { char szEntry[16]; wsprintf(szEntry, "File%lu", (DWORD)i+1); GetPrivateProfileString(lpszSection,szEntry,"",lpTxt, lpMruMenu->wMaxSizeLruItem + 10,lpszFile); if (*lpTxt == '\0') break; SetMenuItem(lpMruMenu,i,lpTxt); } delete lpTxt; return true; }