WetCode

Untitled

Dec 9th, 2013
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.11 KB | None | 0 0
  1. typedef struct tagEXERESINFO
  2. {
  3.     std::vector<LPTSTR> vecIconNames;
  4.     std::vector<LPTSTR> vecGroupNames;
  5.     std::vector<WORD> wLangIcon;
  6.     std::vector<WORD> wLangGroup;
  7.     int nIconCount;
  8.     int nGroupCount;
  9. } EXERESINFO, *LPEXERESINFO;
  10.  
  11.  
  12. //a global vector for storing lpName's
  13. // and yes I know this is evil
  14. EXERESINFO oldExeResInfo;
  15. ///////////////////////////////////
  16.  
  17. BOOL ResLang( HMODULE hModule, LPCTSTR lpszType, LPCTSTR lpszName, WORD wIDLanguage, LONG_PTR lParam)
  18. {
  19.     if (!IS_INTRESOURCE(lpszName))
  20.     {
  21.         if ( lpszType == RT_ICON )
  22.         {
  23.             oldExeResInfo.wLangIcon.push_back( wIDLanguage );
  24.         } else if ( lpszType == (RT_ICON + 11) )
  25.         {
  26.             oldExeResInfo.wLangGroup.push_back( wIDLanguage );
  27.         } else {
  28.             // ....
  29.         }
  30.        
  31.     } else if ( IS_INTRESOURCE(lpszName) ) {
  32.        
  33.         if ( lpszType == RT_ICON )
  34.         {
  35.             oldExeResInfo.wLangIcon.push_back( wIDLanguage );
  36.         } else if ( lpszType == (RT_ICON + 11) )
  37.         {
  38.             oldExeResInfo.wLangGroup.push_back( wIDLanguage );
  39.         } else {
  40.             // ....
  41.         }
  42.        
  43.     } else {
  44.         return FALSE;
  45.     }
  46.  
  47.     return TRUE;
  48. }
  49.  
  50. BOOL ResNames(HMODULE hModule, LPCTSTR lpType, LPTSTR lpName, LONG lParam)
  51. {
  52.  
  53.     if (!IS_INTRESOURCE(lpName))
  54.     {
  55.  
  56.         std::cout << "lpType in Names: " << lpType << std::endl;
  57.         std::cout << "lpType in Names: " << lpName << std::endl;
  58.  
  59.     } else {
  60.         std::cout <<GetLastError()<< "lpType in Names: " << (short)lpType << std::endl;
  61.  
  62.         if ( lpType == RT_ICON )
  63.         {
  64.             oldExeResInfo.nIconCount++;
  65.             oldExeResInfo.vecIconNames.push_back( lpName );
  66.             EnumResourceLanguages( hModule, lpType, lpName, (ENUMRESLANGPROC)ResLang, 0);
  67.         }
  68.  
  69.         if ( lpType == (RT_ICON + 11))
  70.         {
  71.             oldExeResInfo.nGroupCount++;
  72.             oldExeResInfo.vecGroupNames.push_back( lpName );
  73.             EnumResourceLanguages( hModule, lpType, lpName, (ENUMRESLANGPROC)ResLang, 0);
  74.         }
  75.  
  76.     }
  77.  
  78.    return TRUE;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment