Ignore:
Timestamp:
Jul 6, 1999, 10:50:12 AM (26 years ago)
Author:
sandervl
Message:

Edgar Buerkle's codepages changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/pe2lx/dialog.cpp

    r265 r275  
    1 /* $Id: dialog.cpp,v 1.6 1999-07-04 19:02:37 sandervl Exp $ */
     1/* $Id: dialog.cpp,v 1.7 1999-07-06 08:50:11 sandervl Exp $ */
    22
    33/*
     
    1616#define INCL_DOSPROCESS          /* DOS Process values       */
    1717#define INCL_DOSMISC             /* DOS Miscellanous values  */
     18#define INCL_DOSNLS
    1819#define INCL_WIN
    1920#define INCL_WINMLE
     
    4041static void ConvertCaption(ULONG style, char *caption);
    4142static int  ConvertFont(char *font, PRESPARAMS *dlgpparam, int fsize);
    42 static void ShowDialogEx(int id, WINDLGTEMPLATEEX *dhdr, int size);
     43static void ShowDialogEx(int id, WINDLGTEMPLATEEX *dhdr, int size, int cp);
    4344
    4445//******************************************************************************
     
    4849//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    4950//******************************************************************************
    50 void ShowDialog(int id, DialogBoxHeader *dhdr, int size)
     51void ShowDialog(int id, DialogBoxHeader *dhdr, int size, int cp)
    5152{
    5253 WINDLGTEMPLATEEX *windlgex = (WINDLGTEMPLATEEX *)dhdr;
     
    6364 ULONG        ctrlflag, winclass;
    6465 BOOL         fIconBmp;
     66 ULONG        ulCpSize, ulCP;
    6567
    6668  //First save original win32 resource
     
    6870
    6971  if(windlgex->wDlgVer == 1 && windlgex->wSignature == 0xFFFF) {
    70         ShowDialogEx(id, windlgex, size);
     72        ShowDialogEx(id, windlgex, size, cp);
    7173        return;
    7274  }
     
    7981  dlgcurdata = dlgdata;
    8082
    81   dlgt->codepage         = 437;
     83  if(cp == 0) {
     84        dlgt->codepage         = 437;
     85  }
     86  else
     87  {
     88        DosQueryCp(sizeof(ulCP), &ulCP, &ulCpSize);
     89        dlgt->codepage = ulCP;
     90  }
    8291  dlgt->offadlgti        = 14;
    8392  dlgt->fsTemplateStatus = 1;
     
    145154        }
    146155        else {
    147                 cout << "Menu namestring    : " << UnicodeToAscii((WCHAR *)(&dhdr->fNameOrd)) << endl;
     156                cout << "Menu namestring    : " << UnicodeToAscii((WCHAR *)(&dhdr->fNameOrd), cp) << endl;
    148157                ptrArray = (WORD *)((int)&dhdr->fNameOrd + UniStrlen((WCHAR *)(&dhdr->fNameOrd))*2 + sizeof(WCHAR));
    149158        }
     
    159168        }
    160169        else {
    161                 szClass = UnicodeToAscii((WCHAR *)ptrArray);
     170                szClass = UnicodeToAscii((WCHAR *)ptrArray, cp);
    162171                cout << "Class Name            : " << szClass << endl;
    163172
     
    181190  }
    182191  else {
    183         ctrltext = UnicodeToAscii((WCHAR *)(ptrArray));
     192        ctrltext = UnicodeToAscii((WCHAR *)(ptrArray), cp);
    184193        cout << "Title                : " << ctrltext << endl;
    185194        ctrldata = (ControlData *)((int)(int)ptrArray + UniStrlen((WCHAR *)(ptrArray))*2 + sizeof(WORD));
     
    199208  if(dhdr->lStyle & DS_SETFONT) {
    200209        fhdr = (FontHeader *)ctrldata;
    201         font = UnicodeToAscii(fhdr->szFontName);
     210        font = UnicodeToAscii(fhdr->szFontName, cp);
    202211        cout << "Font Point Size      : " << fhdr->wPointSize << endl;
    203212        cout << "Font Name            : " << font << endl;
     
    271280        }
    272281        else {
    273                 szClass = UnicodeToAscii((WCHAR *)&ctrldata->fClassId);
     282                szClass = UnicodeToAscii((WCHAR *)&ctrldata->fClassId, cp);
    274283                cout << "Class Name            : " << szClass << endl;
    275284                szCaption = (WCHAR *)((int)ctrldata + sizeof(ControlData) + strlen(szClass)*2);
     
    289298        }
    290299        else {  //Handle Caption
    291                 ctrltext = UnicodeToAscii(szCaption);
     300                ctrltext = UnicodeToAscii(szCaption, cp);
    292301                //SvL: (16-9-'97) Convert '&' chars to '~' (for some classes)
    293302                ConvertCaption(winclass, ctrltext);
     
    312321                        }
    313322                }
    314                 cout << "Text                  : " << UnicodeToAscii(szCaption) << endl;
     323                cout << "Text                  : " << UnicodeToAscii(szCaption, cp) << endl;
    315324                szCaption = (WCHAR *)((int)szCaption + UniStrlen(szCaption)*2 + sizeof(WORD));
    316325        }
     
    328337//******************************************************************************
    329338//******************************************************************************
    330 void ShowDialogEx(int id, WINDLGTEMPLATEEX *dhdr, int size)
     339void ShowDialogEx(int id, WINDLGTEMPLATEEX *dhdr, int size, int cp)
    331340{
    332341 DLGTEMPLATE *dlgt;
     
    342351 ULONG        ctrlflag, winclass;
    343352 BOOL         fIconBmp;
     353 ULONG        ulCpSize, ulCP;
    344354
    345355  //should be enough
     
    350360  dlgcurdata = dlgdata;
    351361
    352   dlgt->codepage         = 437;
     362  if(cp == 0) {
     363        dlgt->codepage         = 437;
     364  }
     365  else
     366  {
     367        DosQueryCp(sizeof(ulCP), &ulCP, &ulCpSize);
     368        dlgt->codepage = ulCP;
     369  }
    353370  dlgt->offadlgti        = 14;
    354371  dlgt->fsTemplateStatus = 1;
     
    412429        }
    413430        else {
    414                 cout << "Menu namestring    : " << UnicodeToAscii((WCHAR *)(&dhdr->fNameOrd)) << endl;
     431                cout << "Menu namestring    : " << UnicodeToAscii((WCHAR *)(&dhdr->fNameOrd, cp)) << endl;
    415432                ptrArray = (WORD *)((int)&dhdr->fNameOrd + UniStrlen((WCHAR *)(&dhdr->fNameOrd))*2 + sizeof(WCHAR));
    416433        }
     
    448465  }
    449466  else {
    450         ctrltext = UnicodeToAscii((WCHAR *)(ptrArray));
     467        ctrltext = UnicodeToAscii((WCHAR *)(ptrArray), cp);
    451468        cout << "Title                : " << ctrltext << endl;
    452469        ctrldata = (WINDLGITEMTEMPLATEEX *)((int)(int)ptrArray + UniStrlen((WCHAR *)(ptrArray))*2 + sizeof(WORD));
     
    467484  if(dhdr->lStyle & DS_SETFONT) {
    468485        fhdr = (FontHeaderEx *)ctrldata;
    469         font = UnicodeToAscii(fhdr->szFontName);
     486        font = UnicodeToAscii(fhdr->szFontName, cp);
    470487        cout << "Font Point Size      : " << fhdr->wPointSize << endl;
    471488        cout << "Font Name            : " << font << endl;
     
    536553        }
    537554        else {
    538                 szClass = UnicodeToAscii((WCHAR *)&ctrldata->fClassId);
     555                szClass = UnicodeToAscii((WCHAR *)&ctrldata->fClassId, cp);
    539556                cout << "Class Name            : " << szClass << endl;
    540557                szCaption = (WCHAR *)((int)ctrldata + sizeof(WINDLGITEMTEMPLATEEX) + strlen(szClass)*2);
     
    551568        }
    552569        else {  //Handle Caption
    553                 ctrltext = UnicodeToAscii(szCaption);
     570                ctrltext = UnicodeToAscii(szCaption, cp);
    554571                //SvL: (16-9-'97) Convert '&' chars to '~' (for some classes)
    555572                ConvertCaption(winclass, ctrltext);
     
    574591                        }
    575592                }
    576                 cout << "Text                  : " << UnicodeToAscii(szCaption) << endl;
     593                cout << "Text                  : " << UnicodeToAscii(szCaption, cp) << endl;
    577594                szCaption = (WCHAR *)((int)szCaption + UniStrlen(szCaption)*2 + sizeof(WORD));
    578595        }
Note: See TracChangeset for help on using the changeset viewer.