- Timestamp:
- Jun 24, 1999, 6:54:24 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comdlg32/comdlg32.cpp
r162 r181 1 /* $Id: comdlg32.cpp,v 1. 5 1999-06-23 16:39:29achimha Exp $ */1 /* $Id: comdlg32.cpp,v 1.6 1999-06-24 16:54:24 achimha Exp $ */ 2 2 3 3 /* … … 280 280 FreeAsciiString((char*)asciicf.lpTemplateName); 281 281 282 // copy back fields 283 lpcf->Flags = asciicf.Flags; 284 282 285 return bResult; 283 286 } … … 394 397 } 395 398 399 // copy back fields 400 lpfr->Flags = fr.Flags; 401 396 402 return bResult; 397 403 } … … 456 462 char* szFile; 457 463 char* szFileTitle; 464 char* szCustFilter; 458 465 BOOL bResult; 459 466 … … 475 482 ofn.lpstrFilter = UnicodeToAsciiString((WCHAR*)lpofn->lpstrFilter); 476 483 477 if (lpofn->lpstrCustomFilter != NULL)478 ofn.lpstrCustomFilter = UnicodeToAsciiString((WCHAR*)lpofn->lpstrCustomFilter);479 480 484 if (lpofn->lpstrInitialDir != NULL) 481 485 ofn.lpstrInitialDir = UnicodeToAsciiString((WCHAR*)lpofn->lpstrInitialDir); … … 488 492 489 493 szFile = (char*)malloc(lpofn->nMaxFile); 490 szFileTitle = (char*)malloc(lpofn->nMaxFileTitle); 491 ofn.lpstrFile = szFile; 492 ofn.lpstrFileTitle = szFileTitle; 494 szFile[0] = 0; 495 496 if (*lpofn->lpstrFile != 0) 497 UnicodeToAscii(lpofn->lpstrFile, 498 szFile); 499 500 if (lpofn->lpstrFileTitle != NULL) 501 { 502 szFileTitle = (char*)malloc(lpofn->nMaxFileTitle); 503 szFileTitle[0] = 0; 504 505 if (*lpofn->lpstrFileTitle != 0) 506 UnicodeToAscii(lpofn->lpstrFileTitle, 507 szFileTitle); 508 } 509 else 510 szFileTitle = NULL; 511 512 if (lpofn->lpstrCustomFilter != NULL) 513 { 514 szCustFilter = (char*)malloc(lpofn->nMaxCustFilter); 515 szCustFilter[0] = 0; 516 517 518 if (*lpofn->lpstrCustomFilter != 0) 519 UnicodeToAscii(lpofn->lpstrCustomFilter, 520 szCustFilter); 521 } 522 else 523 szCustFilter = NULL; 524 525 ofn.lpstrFile = szFile; 526 ofn.lpstrFileTitle = szFileTitle; 527 ofn.lpstrCustomFilter = szCustFilter; 493 528 494 529 COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC) … … 498 533 if (ofn.lpTemplateName != NULL) FreeAsciiString((char*)ofn.lpTemplateName); 499 534 if (ofn.lpstrFilter != NULL) FreeAsciiString((char*)ofn.lpstrFilter); 500 if (ofn.lpstrCustomFilter != NULL) FreeAsciiString((char*)ofn.lpstrCustomFilter);501 535 if (ofn.lpstrInitialDir != NULL) FreeAsciiString((char*)ofn.lpstrInitialDir); 502 536 if (ofn.lpstrTitle != NULL) FreeAsciiString((char*)ofn.lpstrTitle); … … 504 538 505 539 // transform back the result 506 AsciiToUnicodeN(ofn.lpstrFile, 507 lpofn->lpstrFile, 508 lpofn->nMaxFile); 509 510 AsciiToUnicodeN(ofn.lpstrFileTitle, 511 lpofn->lpstrFileTitle, 512 lpofn->nMaxFileTitle); 513 540 AsciiToUnicode(ofn.lpstrFile, 541 lpofn->lpstrFile); 514 542 free(szFile); 515 free(szFileTitle); 543 544 if (lpofn->lpstrFileTitle != NULL) 545 { 546 AsciiToUnicode(ofn.lpstrFileTitle, 547 lpofn->lpstrFileTitle); 548 free(szFileTitle); 549 } 550 551 if (lpofn->lpstrCustomFilter != NULL) 552 { 553 AsciiToUnicode(ofn.lpstrCustomFilter, 554 lpofn->lpstrCustomFilter); 555 free(szCustFilter); 556 } 557 558 // copy over some altered flags 559 lpofn->nFilterIndex = ofn.nFilterIndex; 560 lpofn->Flags = ofn.Flags; 561 lpofn->nFileOffset = ofn.nFileOffset; 562 lpofn->nFileExtension = ofn.nFileExtension; 516 563 517 564 return bResult; … … 537 584 char* szFile; 538 585 char* szFileTitle; 586 char* szCustFilter; 539 587 BOOL bResult; 540 588 … … 556 604 ofn.lpstrFilter = UnicodeToAsciiString((WCHAR*)lpofn->lpstrFilter); 557 605 558 if (lpofn->lpstrCustomFilter != NULL)559 ofn.lpstrCustomFilter = UnicodeToAsciiString((WCHAR*)lpofn->lpstrCustomFilter);560 561 606 if (lpofn->lpstrInitialDir != NULL) 562 607 ofn.lpstrInitialDir = UnicodeToAsciiString((WCHAR*)lpofn->lpstrInitialDir); … … 568 613 ofn.lpstrDefExt = UnicodeToAsciiString((WCHAR*)lpofn->lpstrDefExt); 569 614 570 // prepare szFile and szFileTitle571 615 szFile = (char*)malloc(lpofn->nMaxFile); 572 szFileTitle = (char*)malloc(lpofn->nMaxFileTitle); 573 574 if (*lpofn->lpstrFile == 0) 575 szFile[0] = 0; 576 else 577 UnicodeToAsciiN(lpofn->lpstrFile, 578 szFile, 579 lpofn->nMaxFile); 580 581 if (*lpofn->lpstrFileTitle == 0) 582 szFileTitle[0] = 0; 583 else 584 UnicodeToAsciiN(lpofn->lpstrFileTitle, 585 szFileTitle, 586 lpofn->nMaxFileTitle); 587 588 ofn.lpstrFile = szFile; 589 ofn.lpstrFileTitle = szFileTitle; 616 szFile[0] = 0; 617 618 if (*lpofn->lpstrFile != 0) 619 UnicodeToAscii(lpofn->lpstrFile, 620 szFile); 621 622 if (lpofn->lpstrFileTitle != NULL) 623 { 624 szFileTitle = (char*)malloc(lpofn->nMaxFileTitle); 625 szFileTitle[0] = 0; 626 627 if (*lpofn->lpstrFileTitle != 0) 628 UnicodeToAscii(lpofn->lpstrFileTitle, 629 szFileTitle); 630 } 631 else 632 szFileTitle = NULL; 633 634 if (lpofn->lpstrCustomFilter != NULL) 635 { 636 szCustFilter = (char*)malloc(lpofn->nMaxCustFilter); 637 szCustFilter[0] = 0; 638 639 640 if (*lpofn->lpstrCustomFilter != 0) 641 UnicodeToAscii(lpofn->lpstrCustomFilter, 642 szCustFilter); 643 } 644 else 645 szCustFilter = NULL; 646 647 ofn.lpstrFile = szFile; 648 ofn.lpstrFileTitle = szFileTitle; 649 ofn.lpstrCustomFilter = szCustFilter; 590 650 591 651 COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC) … … 595 655 if (ofn.lpTemplateName != NULL) FreeAsciiString((char*)ofn.lpTemplateName); 596 656 if (ofn.lpstrFilter != NULL) FreeAsciiString((char*)ofn.lpstrFilter); 597 if (ofn.lpstrCustomFilter != NULL) FreeAsciiString((char*)ofn.lpstrCustomFilter);598 657 if (ofn.lpstrInitialDir != NULL) FreeAsciiString((char*)ofn.lpstrInitialDir); 599 658 if (ofn.lpstrTitle != NULL) FreeAsciiString((char*)ofn.lpstrTitle); … … 601 660 602 661 // transform back the result 662 AsciiToUnicode(ofn.lpstrFile, 663 lpofn->lpstrFile); 664 free(szFile); 665 666 if (lpofn->lpstrFileTitle != NULL) 667 { 668 AsciiToUnicode(ofn.lpstrFileTitle, 669 lpofn->lpstrFileTitle); 670 free(szFileTitle); 671 } 672 673 if (lpofn->lpstrCustomFilter != NULL) 674 { 675 AsciiToUnicode(ofn.lpstrCustomFilter, 676 lpofn->lpstrCustomFilter); 677 free(szCustFilter); 678 } 679 680 // copy over some altered flags 681 lpofn->nFilterIndex = ofn.nFilterIndex; 682 lpofn->Flags = ofn.Flags; 603 683 lpofn->nFileOffset = ofn.nFileOffset; 604 684 lpofn->nFileExtension = ofn.nFileExtension; 605 // @@@PH: remark - are these all required pass-back fields ?606 607 AsciiToUnicodeN(ofn.lpstrFile,608 lpofn->lpstrFile,609 lpofn->nMaxFile);610 611 AsciiToUnicodeN(ofn.lpstrFileTitle,612 lpofn->lpstrFileTitle,613 lpofn->nMaxFileTitle);614 615 free(szFile);616 free(szFileTitle);617 685 618 686 return bResult; 619 687 } 688 620 689 621 690 /***************************************************************************** … … 693 762 694 763 // copy back result 764 lppd->Flags = pd.Flags; 695 765 lppd->nFromPage = pd.nFromPage; 696 766 lppd->nToPage = pd.nToPage; … … 794 864 } 795 865 866 // copy back fields 867 lpfr->Flags = fr.Flags; 868 796 869 return bResult; 797 798 870 } 799 871
Note:
See TracChangeset
for help on using the changeset viewer.