home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 June / CHIP_CD_2004-06.iso / software / miranda_hit / files / mirinstsetup.exe / Miranda Installer 0.0.1.2 / lpservices.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2004-04-20  |  2.4 KB  |  85 lines

  1. /*
  2.  
  3. Miranda IM: the free IM client for Microsoft* Windows*
  4. This is a modified copy of Miranda IM's Language Pack module.
  5. Modified on: November 21st, 2003
  6.  
  7. Copyright 2000-2003 Miranda ICQ/IM project, 
  8. all portions of this codebase are copyrighted to the people 
  9. listed in contributors.txt.
  10.  
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15.  
  16. This program is distributed in the hope that it will be useful,
  17. but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. GNU General Public License for more details.
  20.  
  21. You should have received a copy of the GNU General Public License
  22. along with this program; if not, write to the Free Software
  23. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  24. */
  25. #include "../MirandaInstaller.h"
  26. #pragma hdrstop
  27.  
  28. static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd,LPARAM lParam)
  29. {
  30.     char title[2048],szClass[32];
  31.     int id=GetDlgCtrlID(hwnd);
  32.     
  33.     GetClassName(hwnd,szClass,sizeof(szClass));
  34.     if(!lstrcmpi(szClass,"static") || !lstrcmpi(szClass,"hyperlink") || !lstrcmpi(szClass,"button") || !strcmpi(szClass,"MButtonClass")) {
  35.         GetWindowText(hwnd,title,sizeof(title));
  36.         SetWindowText(hwnd,Translate(title));
  37.     }
  38.     else if(!lstrcmpi(szClass,"edit")) {
  39.         if(GetWindowLong(hwnd,GWL_STYLE)&ES_READONLY) {
  40.             GetWindowText(hwnd,title,sizeof(title));
  41.             SetWindowText(hwnd,Translate(title));
  42.         }
  43.     }
  44.     return TRUE;
  45. }
  46.  
  47.  
  48. void LP_TranslateMenu(HMENU hMenu)
  49. {
  50.     int i;
  51.     MENUITEMINFO mii;
  52.     char str[256];
  53.  
  54.     mii.cbSize = sizeof(MENUITEMINFO);
  55.     for(i=GetMenuItemCount(hMenu)-1;i>=0;i--) {
  56.         mii.fMask=MIIM_TYPE|MIIM_SUBMENU;
  57.         mii.dwTypeData=str;
  58.         mii.cch=sizeof(str);
  59.         GetMenuItemInfo(hMenu,i,TRUE,&mii);
  60.         if(mii.cch) {
  61.             mii.dwTypeData=Translate(mii.dwTypeData);
  62.             mii.fMask=MIIM_TYPE;
  63.             SetMenuItemInfo(hMenu,i,TRUE,&mii);
  64.         }
  65.         if(mii.hSubMenu!=NULL) LP_TranslateMenu(mii.hSubMenu);
  66.     }
  67. }
  68.  
  69.  
  70. void LP_TranslateDialog(HWND hwndDlg)
  71. {
  72.     // always work out the title
  73.     char title[256];
  74.     GetWindowText(hwndDlg,title,sizeof(title));
  75.     SetWindowText(hwndDlg,Translate(title));
  76.  
  77.     // menu
  78.     HMENU hMenu = GetMenu(hwndDlg);
  79.     if (hMenu)
  80.     {
  81.         LP_TranslateMenu(hMenu);
  82.     }
  83.  
  84.     EnumChildWindows(hwndDlg,TranslateDialogEnumProc,0);
  85. }