Changeset 275 for trunk/src/pe2lx/dialog.cpp
- Timestamp:
- Jul 6, 1999, 10:50:12 AM (26 years ago)
- 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:37sandervl Exp $ */1 /* $Id: dialog.cpp,v 1.7 1999-07-06 08:50:11 sandervl Exp $ */ 2 2 3 3 /* … … 16 16 #define INCL_DOSPROCESS /* DOS Process values */ 17 17 #define INCL_DOSMISC /* DOS Miscellanous values */ 18 #define INCL_DOSNLS 18 19 #define INCL_WIN 19 20 #define INCL_WINMLE … … 40 41 static void ConvertCaption(ULONG style, char *caption); 41 42 static int ConvertFont(char *font, PRESPARAMS *dlgpparam, int fsize); 42 static void ShowDialogEx(int id, WINDLGTEMPLATEEX *dhdr, int size );43 static void ShowDialogEx(int id, WINDLGTEMPLATEEX *dhdr, int size, int cp); 43 44 44 45 //****************************************************************************** … … 48 49 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 49 50 //****************************************************************************** 50 void ShowDialog(int id, DialogBoxHeader *dhdr, int size )51 void ShowDialog(int id, DialogBoxHeader *dhdr, int size, int cp) 51 52 { 52 53 WINDLGTEMPLATEEX *windlgex = (WINDLGTEMPLATEEX *)dhdr; … … 63 64 ULONG ctrlflag, winclass; 64 65 BOOL fIconBmp; 66 ULONG ulCpSize, ulCP; 65 67 66 68 //First save original win32 resource … … 68 70 69 71 if(windlgex->wDlgVer == 1 && windlgex->wSignature == 0xFFFF) { 70 ShowDialogEx(id, windlgex, size );72 ShowDialogEx(id, windlgex, size, cp); 71 73 return; 72 74 } … … 79 81 dlgcurdata = dlgdata; 80 82 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 } 82 91 dlgt->offadlgti = 14; 83 92 dlgt->fsTemplateStatus = 1; … … 145 154 } 146 155 else { 147 cout << "Menu namestring : " << UnicodeToAscii((WCHAR *)(&dhdr->fNameOrd) ) << endl;156 cout << "Menu namestring : " << UnicodeToAscii((WCHAR *)(&dhdr->fNameOrd), cp) << endl; 148 157 ptrArray = (WORD *)((int)&dhdr->fNameOrd + UniStrlen((WCHAR *)(&dhdr->fNameOrd))*2 + sizeof(WCHAR)); 149 158 } … … 159 168 } 160 169 else { 161 szClass = UnicodeToAscii((WCHAR *)ptrArray );170 szClass = UnicodeToAscii((WCHAR *)ptrArray, cp); 162 171 cout << "Class Name : " << szClass << endl; 163 172 … … 181 190 } 182 191 else { 183 ctrltext = UnicodeToAscii((WCHAR *)(ptrArray) );192 ctrltext = UnicodeToAscii((WCHAR *)(ptrArray), cp); 184 193 cout << "Title : " << ctrltext << endl; 185 194 ctrldata = (ControlData *)((int)(int)ptrArray + UniStrlen((WCHAR *)(ptrArray))*2 + sizeof(WORD)); … … 199 208 if(dhdr->lStyle & DS_SETFONT) { 200 209 fhdr = (FontHeader *)ctrldata; 201 font = UnicodeToAscii(fhdr->szFontName );210 font = UnicodeToAscii(fhdr->szFontName, cp); 202 211 cout << "Font Point Size : " << fhdr->wPointSize << endl; 203 212 cout << "Font Name : " << font << endl; … … 271 280 } 272 281 else { 273 szClass = UnicodeToAscii((WCHAR *)&ctrldata->fClassId );282 szClass = UnicodeToAscii((WCHAR *)&ctrldata->fClassId, cp); 274 283 cout << "Class Name : " << szClass << endl; 275 284 szCaption = (WCHAR *)((int)ctrldata + sizeof(ControlData) + strlen(szClass)*2); … … 289 298 } 290 299 else { //Handle Caption 291 ctrltext = UnicodeToAscii(szCaption );300 ctrltext = UnicodeToAscii(szCaption, cp); 292 301 //SvL: (16-9-'97) Convert '&' chars to '~' (for some classes) 293 302 ConvertCaption(winclass, ctrltext); … … 312 321 } 313 322 } 314 cout << "Text : " << UnicodeToAscii(szCaption ) << endl;323 cout << "Text : " << UnicodeToAscii(szCaption, cp) << endl; 315 324 szCaption = (WCHAR *)((int)szCaption + UniStrlen(szCaption)*2 + sizeof(WORD)); 316 325 } … … 328 337 //****************************************************************************** 329 338 //****************************************************************************** 330 void ShowDialogEx(int id, WINDLGTEMPLATEEX *dhdr, int size )339 void ShowDialogEx(int id, WINDLGTEMPLATEEX *dhdr, int size, int cp) 331 340 { 332 341 DLGTEMPLATE *dlgt; … … 342 351 ULONG ctrlflag, winclass; 343 352 BOOL fIconBmp; 353 ULONG ulCpSize, ulCP; 344 354 345 355 //should be enough … … 350 360 dlgcurdata = dlgdata; 351 361 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 } 353 370 dlgt->offadlgti = 14; 354 371 dlgt->fsTemplateStatus = 1; … … 412 429 } 413 430 else { 414 cout << "Menu namestring : " << UnicodeToAscii((WCHAR *)(&dhdr->fNameOrd )) << endl;431 cout << "Menu namestring : " << UnicodeToAscii((WCHAR *)(&dhdr->fNameOrd, cp)) << endl; 415 432 ptrArray = (WORD *)((int)&dhdr->fNameOrd + UniStrlen((WCHAR *)(&dhdr->fNameOrd))*2 + sizeof(WCHAR)); 416 433 } … … 448 465 } 449 466 else { 450 ctrltext = UnicodeToAscii((WCHAR *)(ptrArray) );467 ctrltext = UnicodeToAscii((WCHAR *)(ptrArray), cp); 451 468 cout << "Title : " << ctrltext << endl; 452 469 ctrldata = (WINDLGITEMTEMPLATEEX *)((int)(int)ptrArray + UniStrlen((WCHAR *)(ptrArray))*2 + sizeof(WORD)); … … 467 484 if(dhdr->lStyle & DS_SETFONT) { 468 485 fhdr = (FontHeaderEx *)ctrldata; 469 font = UnicodeToAscii(fhdr->szFontName );486 font = UnicodeToAscii(fhdr->szFontName, cp); 470 487 cout << "Font Point Size : " << fhdr->wPointSize << endl; 471 488 cout << "Font Name : " << font << endl; … … 536 553 } 537 554 else { 538 szClass = UnicodeToAscii((WCHAR *)&ctrldata->fClassId );555 szClass = UnicodeToAscii((WCHAR *)&ctrldata->fClassId, cp); 539 556 cout << "Class Name : " << szClass << endl; 540 557 szCaption = (WCHAR *)((int)ctrldata + sizeof(WINDLGITEMTEMPLATEEX) + strlen(szClass)*2); … … 551 568 } 552 569 else { //Handle Caption 553 ctrltext = UnicodeToAscii(szCaption );570 ctrltext = UnicodeToAscii(szCaption, cp); 554 571 //SvL: (16-9-'97) Convert '&' chars to '~' (for some classes) 555 572 ConvertCaption(winclass, ctrltext); … … 574 591 } 575 592 } 576 cout << "Text : " << UnicodeToAscii(szCaption ) << endl;593 cout << "Text : " << UnicodeToAscii(szCaption, cp) << endl; 577 594 szCaption = (WCHAR *)((int)szCaption + UniStrlen(szCaption)*2 + sizeof(WORD)); 578 595 }
Note:
See TracChangeset
for help on using the changeset viewer.