Changeset 1556 for trunk/src/comdlg32/filedlg95.cpp
- Timestamp:
- Nov 2, 1999, 9:37:43 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comdlg32/filedlg95.cpp
r1548 r1556 1 /* $Id: filedlg95.cpp,v 1. 1 1999-11-02 19:09:42 sandervl Exp $ */1 /* $Id: filedlg95.cpp,v 1.2 1999-11-02 20:37:42 sandervl Exp $ */ 2 2 /* 3 * COMMDLG - File Open Dialogs Win95 look and feel (990815) 4 * 5 */ 6 // ><DJR 17.05.99 Force to use C-interfaces for now to prevent CALLBACK definition compiler error 7 #define CINTERFACE 1 8 3 * COMMDLG - File Open Dialogs Win95 look and feel 4 * 5 */ 9 6 #include <ctype.h> 10 7 #include <stdlib.h> 11 8 #include <string.h> 9 #ifdef __WIN32OS2__ 10 // ><DJR 17.05.99 Force to use C-interfaces for now to prevent CALLBACK definition compiler error 11 #define CINTERFACE 1 12 12 #include <os2win.h> 13 #else 14 #include "winbase.h" 15 #include "tweak.h" 16 #endif 13 17 #include "ldt.h" 14 18 #include "heap.h" 15 19 #include "commdlg.h" 16 20 #include "dlgs.h" 21 #include "cdlg.h" 17 22 #include "debugtools.h" 18 23 #include "cderr.h" 19 //#include "tweak.h"20 24 #include "winnls.h" 21 25 #include "shellapi.h" 22 #include "commctrl.h"23 26 #include "tchar.h" 24 27 #include "filedlgbrowser.h" 25 #include "wine/undocshell.h"26 28 #include "wine/obj_contextmenu.h" 27 29 30 #ifdef __WIN32OS2__ 31 #include <heapstring.h> 32 33 #define MapHModuleSL(a) a 34 #define MapHModuleLS(a) a 35 #endif 36 28 37 DEFAULT_DEBUG_CHANNEL(commdlg) 29 38 30 #include "cdlg.h"31 32 #include <heapstring.h>33 39 34 40 /*********************************************************************** … … 105 111 #define CBShowDropDown(hwnd,show) \ 106 112 SendMessageA(hwnd,CB_SHOWDROPDOWN,(WPARAM)show,0); 113 #define CBSetItemHeight(hwnd,index,height) \ 114 SendMessageA(hwnd,CB_SETITEMHEIGHT,(WPARAM)index,(LPARAM)height); 107 115 108 116 … … 129 137 static BOOL FILEDLG95_SHELL_ExecuteCommand(HWND hwnd, LPCSTR lpVerb); 130 138 static BOOL FILEDLG95_SHELL_NewFolder(HWND hwnd); 131 BOOL FILEDLG95_SHELL_FillIncludedItemList(HWND hwnd,132 LPITEMIDLIST pidlCurrentFolder,133 LPSTR lpstrMask);134 139 static void FILEDLG95_SHELL_Clean(HWND hwnd); 140 135 141 /* Functions used by the filetype combo box */ 136 142 static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd); … … 159 165 /* Shell memory allocation */ 160 166 char *MemAlloc(UINT size); 161 void 167 void MemFree(void *mem); 162 168 163 169 BOOL WINAPI GetOpenFileName95(FileOpenDlgInfos *fodInfos); … … 179 185 180 186 LRESULT lRes; 181 LPCVOID dlgtemplate;187 LPCVOID templateDlg; 182 188 HRSRC hRes; 183 189 HANDLE hDlgTmpl = 0; … … 185 191 /* Create the dialog from a template */ 186 192 187 if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATEHANDLE)188 {189 #ifdef __WIN32OS2__190 if (!(dlgtemplate = LockResource( fodInfos->ofnInfos.hInstance)))191 #else192 if (!(dlgtemplate = LockResource( MapHModuleSL(fodInfos->ofnInfos.hInstance ))))193 #endif194 {195 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);196 return FALSE;197 }198 }199 else if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATE)200 {201 #ifdef __WIN32OS2__202 if (!(hRes = FindResourceA(fodInfos->ofnInfos.hInstance,203 #else204 if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos.hInstance),205 #endif206 (fodInfos->ofnInfos.lpTemplateName), RT_DIALOGA)))207 {208 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);209 return FALSE;210 }211 #ifdef __WIN32OS2__212 if (!(hDlgTmpl = LoadResource( fodInfos->ofnInfos.hInstance,213 #else214 if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos.hInstance),215 #endif216 hRes )) ||217 !(dlgtemplate = LockResource( hDlgTmpl )))218 {219 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);220 return FALSE;221 }222 }223 else224 {225 193 if(!(hRes = FindResourceA(COMDLG32_hInstance,MAKEINTRESOURCEA(IDD_OPENDIALOG),RT_DIALOGA))) 226 194 { … … 229 197 } 230 198 if (!(hDlgTmpl = LoadResource(COMDLG32_hInstance, hRes )) || 231 !( dlgtemplate= LockResource( hDlgTmpl )))199 !(templateDlg = LockResource( hDlgTmpl ))) 232 200 { 233 201 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 234 202 return FALSE; 235 203 } 236 }237 238 204 lRes = DialogBoxIndirectParamA(COMDLG32_hInstance, 239 (LPDLGTEMPLATEA) dlgtemplate,205 (LPDLGTEMPLATEA) templateDlg, 240 206 fodInfos->ofnInfos.hwndOwner, 241 207 (DLGPROC) FileOpenDlgProc95, … … 263 229 264 230 LRESULT lRes; 265 LPCVOID dlgtemplate;231 LPCVOID templateDlg; 266 232 HRSRC hRes; 267 233 HANDLE hDlgTmpl = 0; … … 269 235 /* Create the dialog from a template */ 270 236 271 if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATEHANDLE)272 {273 #ifdef __WIN32OS2__274 if (!(dlgtemplate = LockResource( fodInfos->ofnInfos.hInstance)))275 #else276 if (!(dlgtemplate = LockResource( MapHModuleSL(fodInfos->ofnInfos.hInstance ))))277 #endif278 {279 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);280 return FALSE;281 }282 }283 else if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATE)284 {285 #ifdef __WIN32OS2__286 if (!(hRes = FindResourceA(fodInfos->ofnInfos.hInstance,287 #else288 if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos.hInstance),289 #endif290 (fodInfos->ofnInfos.lpTemplateName), RT_DIALOGA)))291 {292 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);293 return FALSE;294 }295 #ifdef __WIN32OS2__296 if (!(hDlgTmpl = LoadResource( fodInfos->ofnInfos.hInstance,297 #else298 if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos.hInstance),299 #endif300 hRes )) ||301 !(dlgtemplate = LockResource( hDlgTmpl )))302 {303 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);304 return FALSE;305 }306 }307 else308 {309 237 if(!(hRes = FindResourceA(COMDLG32_hInstance,MAKEINTRESOURCEA(IDD_SAVEDIALOG),RT_DIALOGA))) 310 238 { … … 313 241 } 314 242 if (!(hDlgTmpl = LoadResource(COMDLG32_hInstance, hRes )) || 315 !( dlgtemplate= LockResource( hDlgTmpl )))243 !(templateDlg = LockResource( hDlgTmpl ))) 316 244 { 317 245 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 318 246 return FALSE; 319 247 } 320 }321 248 lRes = DialogBoxIndirectParamA(COMDLG32_hInstance, 322 (LPDLGTEMPLATEA) dlgtemplate,249 (LPDLGTEMPLATEA) templateDlg, 323 250 fodInfos->ofnInfos.hwndOwner, 324 251 (DLGPROC) FileOpenDlgProc95, … … 350 277 memset(&fodInfos->ofnInfos,'\0',sizeof(*ofn)); fodInfos->ofnInfos.lStructSize = sizeof(*ofn); 351 278 fodInfos->ofnInfos.hwndOwner = ofn->hwndOwner; 352 #ifdef __WIN32OS2__353 fodInfos->ofnInfos.hInstance = ofn->hInstance;354 #else355 279 fodInfos->ofnInfos.hInstance = MapHModuleLS(ofn->hInstance); 356 #endif357 280 if (ofn->lpstrFilter) 358 281 { … … 377 300 s = s+strlen(s)+1; 378 301 s++; 379 x = (LPSTR)MemAlloc(s-ofn->lpstrCustomFilter);302 x = MemAlloc(s-ofn->lpstrCustomFilter); 380 303 memcpy(x,ofn->lpstrCustomFilter,s-ofn->lpstrCustomFilter); 381 304 fodInfos->ofnInfos.lpstrCustomFilter = (LPSTR)x; … … 395 318 if (ofn->lpstrInitialDir) 396 319 { 397 fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(strlen(ofn->lpstrInitialDir) );320 fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(strlen(ofn->lpstrInitialDir)+1); 398 321 strcpy((LPSTR)fodInfos->ofnInfos.lpstrInitialDir,ofn->lpstrInitialDir); 399 322 } … … 401 324 if (ofn->lpstrTitle) 402 325 { 403 fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(strlen(ofn->lpstrTitle) );326 fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(strlen(ofn->lpstrTitle)+1); 404 327 strcpy((LPSTR)fodInfos->ofnInfos.lpstrTitle,ofn->lpstrTitle); 405 328 } … … 410 333 if (ofn->lpstrDefExt) 411 334 { 412 fodInfos->ofnInfos.lpstrDefExt = (char *)MemAlloc(strlen(ofn->lpstrDefExt));335 fodInfos->ofnInfos.lpstrDefExt = MemAlloc(strlen(ofn->lpstrDefExt)+1); 413 336 strcpy((LPSTR)fodInfos->ofnInfos.lpstrDefExt,ofn->lpstrDefExt); 414 337 } … … 418 341 if (ofn->lpTemplateName) 419 342 { 420 /* template don't work - using normal dialog */ 421 /* fodInfos->ofnInfos.lpTemplateName = MemAlloc(strlen(ofn->lpTemplateName)); 422 strcpy((LPSTR)fodInfos->ofnInfos.lpTemplateName,ofn->lpTemplateName);*/ 423 fodInfos->ofnInfos.Flags &= ~OFN_ENABLETEMPLATEHANDLE; 424 fodInfos->ofnInfos.Flags &= ~OFN_ENABLETEMPLATE; 425 FIXME("File dialog 95 template not implemented\n"); 426 343 fodInfos->ofnInfos.lpTemplateName = ofn->lpTemplateName; 427 344 } 428 345 … … 430 347 if(!ofn->lpstrInitialDir) 431 348 { 432 fodInfos->ofnInfos.lpstrInitialDir = (char *)MemAlloc(MAX_PATH);349 fodInfos->ofnInfos.lpstrInitialDir = MemAlloc(MAX_PATH); 433 350 GetCurrentDirectoryA(MAX_PATH,(LPSTR)fodInfos->ofnInfos.lpstrInitialDir); 434 351 } 435 352 353 /* Initialise the dialog property */ 354 fodInfos->DlgInfos.dwDlgProp = 0; 355 436 356 switch(iDlgType) 437 357 { … … 440 360 break; 441 361 case SAVE_DIALOG : 362 fodInfos->DlgInfos.dwDlgProp |= FODPROP_SAVEDLG; 442 363 ret = GetSaveFileName95(fodInfos); 443 364 break; … … 497 418 fodInfos->ofnInfos.lStructSize = sizeof(*ofn); 498 419 fodInfos->ofnInfos.hwndOwner = ofn->hwndOwner; 499 #ifdef __WIN32OS2__500 fodInfos->ofnInfos.hInstance = ofn->hInstance;501 #else502 420 fodInfos->ofnInfos.hInstance = MapHModuleLS(ofn->hInstance); 503 #endif504 421 if (ofn->lpstrFilter) 505 422 { … … 555 472 fodInfos->ofnInfos.lpstrFileTitle = (LPSTR)MemAlloc(ofn->nMaxFileTitle); 556 473 if (ofn->lpstrInitialDir) 557 fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrInitialDir)); 474 { 475 fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrInitialDir)+1); 476 lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpstrInitialDir,(LPWSTR)ofn->lpstrInitialDir); 477 } 558 478 if (ofn->lpstrTitle) 559 fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrTitle)); 479 { 480 fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrTitle)+1); 481 lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpstrTitle,(LPWSTR)ofn->lpstrTitle); 482 } 560 483 fodInfos->ofnInfos.Flags = ofn->Flags|OFN_WINE|OFN_UNICODE; 561 484 fodInfos->ofnInfos.nFileOffset = ofn->nFileOffset; 562 485 fodInfos->ofnInfos.nFileExtension = ofn->nFileExtension; 563 486 if (ofn->lpstrDefExt) 564 fodInfos->ofnInfos.lpstrDefExt = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrDefExt)); 487 { 488 fodInfos->ofnInfos.lpstrDefExt = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrDefExt)+1); 489 lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpstrDefExt,(LPWSTR)ofn->lpstrDefExt); 490 } 565 491 fodInfos->ofnInfos.lCustData = ofn->lCustData; 566 492 fodInfos->ofnInfos.lpfnHook = (LPOFNHOOKPROC)ofn->lpfnHook; 567 493 if (ofn->lpTemplateName) 568 fodInfos->ofnInfos.lpTemplateName = (LPSTR)MemAlloc(lstrlenW(ofn->lpTemplateName)); 494 { 495 fodInfos->ofnInfos.lpTemplateName = (LPSTR)MemAlloc(lstrlenW(ofn->lpTemplateName)+1); 496 lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpTemplateName,(LPWSTR)ofn->lpTemplateName); 497 } 498 /* Initialise the dialog property */ 499 fodInfos->DlgInfos.dwDlgProp = 0; 500 569 501 switch(iDlgType) 570 502 { … … 573 505 break; 574 506 case SAVE_DIALOG : 507 fodInfos->DlgInfos.dwDlgProp |= FODPROP_SAVEDLG; 575 508 ret = GetSaveFileName95(fodInfos); 576 509 break; … … 579 512 } 580 513 581 582 514 /* Cleaning */ 583 515 ofn->nFileOffset = fodInfos->ofnInfos.nFileOffset; … … 612 544 } 613 545 546 void ArrangeCtrlPositions( HWND hwndChildDlg, HWND hwndParentDlg) 547 { 548 549 HWND hwndChild,hwndStc32; 550 RECT rectParent,rectChild,rectCtrl,rectStc32; 551 POINT ptMoveCtl; 552 HDWP handle; 553 POINT ptParentClient; 554 555 ptMoveCtl.x = ptMoveCtl.y = 0; 556 hwndStc32=GetDlgItem(hwndChildDlg,stc32); 557 GetClientRect(hwndParentDlg,&rectParent); 558 GetClientRect(hwndChildDlg,&rectChild); 559 if(hwndStc32) 560 { 561 RECT rectTemp; 562 GetWindowRect(hwndStc32,&rectStc32); 563 MapWindowPoints(0, hwndChildDlg,(LPPOINT)&rectStc32,2); 564 CopyRect(&rectTemp,&rectStc32); 565 566 SetRect(&rectStc32,rectStc32.left,rectStc32.top,rectStc32.left + (rectParent.right-rectParent.left),rectStc32.top+(rectParent.bottom-rectParent.top)); 567 SetWindowPos(hwndStc32,0,rectStc32.left,rectStc32.top,rectStc32.right-rectStc32.left,rectStc32.bottom-rectStc32.top,SWP_NOMOVE|SWP_NOZORDER | SWP_NOACTIVATE); 568 if(rectStc32.right < rectTemp.right) 569 { 570 ptParentClient.x = max((rectParent.right-rectParent.left),(rectChild.right-rectChild.left)); 571 ptMoveCtl.x = 0; 572 } 573 else 574 { 575 ptMoveCtl.x = (rectStc32.right - rectTemp.right); 576 ptParentClient.x = max((rectParent.right-rectParent.left),((rectChild.right-rectChild.left)+rectStc32.right-rectTemp.right)); 577 } 578 if(rectStc32.bottom < rectTemp.bottom) 579 { 580 ptParentClient.y = max((rectParent.bottom-rectParent.top),(rectChild.bottom-rectChild.top)); 581 ptMoveCtl.y = 0; 582 } 583 else 584 { 585 ptMoveCtl.y = (rectStc32.bottom - rectTemp.bottom); 586 ptParentClient.y = max((rectParent.bottom-rectParent.top),((rectChild.bottom-rectChild.top)+rectStc32.bottom-rectTemp.bottom)); 587 } 588 } 589 else 590 { 591 if( (GetWindow(hwndChildDlg,GW_CHILD)) == (HWND) NULL) 592 return; 593 ptParentClient.x = rectParent.right-rectParent.left; 594 ptParentClient.y = (rectParent.bottom-rectParent.top) + (rectChild.bottom-rectChild.top); 595 ptMoveCtl.y = rectParent.bottom-rectParent.top; 596 ptMoveCtl.x=0; 597 } 598 SetRect(&rectParent,rectParent.left,rectParent.top,rectParent.left+ptParentClient.x,rectParent.top+ptParentClient.y); 599 AdjustWindowRectEx( &rectParent,GetWindowLongA(hwndParentDlg,GWL_STYLE),FALSE,GetWindowLongA(hwndParentDlg,GWL_EXSTYLE)); 600 601 SetWindowPos(hwndChildDlg, 0, 0,0, ptParentClient.x,ptParentClient.y, 602 SWP_NOZORDER ); 603 SetWindowPos(hwndParentDlg, 0, rectParent.left,rectParent.top, (rectParent.right- rectParent.left), 604 (rectParent.bottom-rectParent.top),SWP_NOMOVE | SWP_NOZORDER); 605 606 hwndChild = GetWindow(hwndChildDlg,GW_CHILD); 607 handle = BeginDeferWindowPos( 1 ); 608 if(hwndStc32) 609 { 610 GetWindowRect(hwndStc32,&rectStc32); 611 MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2); 612 } 613 else 614 SetRect(&rectStc32,0,0,0,0); 615 if (hwndChild && handle) 616 { 617 do 618 { 619 if(hwndChild != hwndStc32) 620 { 621 if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE) 622 continue; 623 GetWindowRect(hwndChild,&rectCtrl); 624 MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2); 625 if(rectCtrl.top > rectStc32.top) 626 { 627 628 if(ptMoveCtl.x > 0) 629 rectCtrl.left += ptMoveCtl.x; 630 rectCtrl.top += ptMoveCtl.y; 631 handle = DeferWindowPos(handle, hwndChild, 0, rectCtrl.left, rectCtrl.top, 632 rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top, 633 SWP_NOSIZE | SWP_NOZORDER ); 634 } 635 } 636 } 637 while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL && handle); 638 } 639 if(handle) 640 EndDeferWindowPos( handle ); 641 handle = BeginDeferWindowPos( 1 ); 642 hwndChild = GetWindow(hwndParentDlg,GW_CHILD); 643 if(hwndStc32) 644 { 645 GetWindowRect(hwndStc32,&rectStc32); 646 MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2); 647 ptMoveCtl.x = rectStc32.left - 0; 648 ptMoveCtl.y = rectStc32.top - 0; 649 if (hwndChild && handle) 650 { 651 do 652 { 653 if(hwndChild != hwndChildDlg) 654 { 655 656 if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE) 657 continue; 658 GetWindowRect(hwndChild,&rectCtrl); 659 MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2); 660 661 rectCtrl.left += ptMoveCtl.x; 662 rectCtrl.top += ptMoveCtl.y; 663 664 handle = DeferWindowPos( handle, hwndChild, 0, rectCtrl.left, rectCtrl.top, 665 rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top, 666 SWP_NOSIZE |SWP_NOZORDER ); 667 } 668 } 669 while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL); 670 } 671 if(handle) 672 EndDeferWindowPos( handle ); 673 } 674 675 } 676 677 678 HRESULT WINAPI FileOpenDlgProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 679 { 680 static WNDPROC procUserHook=NULL; 681 switch(uMsg) 682 { 683 case WM_INITDIALOG: 684 { 685 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *)lParam; 686 procUserHook=NULL; 687 lParam = (LPARAM) &fodInfos->ofnInfos; 688 ArrangeCtrlPositions(hwnd,GetParent(hwnd)); 689 if(fodInfos->ofnInfos.Flags & OFN_ENABLEHOOK) 690 procUserHook = (WNDPROC) fodInfos->ofnInfos.lpfnHook; 691 if(procUserHook) 692 return CallWindowProcA(procUserHook,hwnd,uMsg,wParam,lParam); 693 return 0; 694 } } 695 if(procUserHook) 696 return CallWindowProcA(procUserHook,hwnd,uMsg,wParam,lParam); 697 return DefWindowProcA(hwnd,uMsg,wParam,lParam); 698 } 699 700 HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos,HWND hwnd) 701 { 702 LPCVOID templateDlg; 703 HRSRC hRes; 704 HANDLE hDlgTmpl = 0; 705 HWND hChildDlg = 0; 706 if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATE || fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATEHANDLE) 707 { 708 if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATEHANDLE) 709 { 710 if( !(templateDlg = LockResource( fodInfos->ofnInfos.hInstance))) 711 { 712 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 713 return (HWND)NULL; 714 } 715 716 } 717 else 718 { 719 if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos.hInstance), 720 (fodInfos->ofnInfos.lpTemplateName), RT_DIALOGA))) 721 { 722 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); 723 return (HWND)NULL; 724 } 725 if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos.hInstance), 726 hRes )) || 727 !(templateDlg = LockResource( hDlgTmpl ))) 728 { 729 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); 730 return (HWND)NULL; 731 } 732 } 733 734 hChildDlg= CreateDialogIndirectParamA(fodInfos->ofnInfos.hInstance,(LPCDLGTEMPLATEA)templateDlg,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos); 735 if(hChildDlg) 736 { 737 ShowWindow(hChildDlg,SW_SHOW); 738 return hChildDlg; 739 } 740 } 741 else if(fodInfos->ofnInfos.Flags & OFN_ENABLEHOOK && fodInfos->ofnInfos.lpfnHook) 742 { 743 RECT rectHwnd; 744 DLGTEMPLATE tmplate; 745 GetClientRect(hwnd,&rectHwnd); 746 tmplate.style = WS_CHILD | WS_CLIPSIBLINGS; 747 tmplate.dwExtendedStyle = 0; 748 tmplate.cdit = 0; 749 tmplate.x = 0; 750 tmplate.y = 0; 751 tmplate.cx = rectHwnd.right-rectHwnd.left; 752 tmplate.cy = rectHwnd.bottom-rectHwnd.top; 753 754 return CreateDialogIndirectParamA(fodInfos->ofnInfos.hInstance,&tmplate,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos); 755 } 756 return (HWND)NULL; 757 } 614 758 615 759 /*********************************************************************** … … 624 768 { 625 769 case WM_INITDIALOG : 770 CreateTemplateDialog((FileOpenDlgInfos *)lParam,hwnd); 626 771 return FILEDLG95_OnWMInitDialog(hwnd, wParam, lParam); 627 772 case WM_COMMAND: … … 637 782 } 638 783 return FALSE; 639 #ifndef __WIN32OS2__784 640 785 case WM_GETISHELLBROWSER: 641 786 return FILEDLG95_OnWMGetIShellBrowser(hwnd); 642 #endif643 787 644 788 case WM_DESTROY: 645 789 RemovePropA(hwnd, FileOpenDlgInfosStr); 790 646 791 default : 647 792 return FALSE; … … 698 843 699 844 /* Free pidlItem memory */ 700 SHFree(pidlItemId);845 COMDLG32_SHFree(pidlItemId); 701 846 702 847 return TRUE; … … 722 867 WORD wNotifyCode = HIWORD(wParam); /* notification code */ 723 868 WORD wID = LOWORD(wParam); /* item, control, or accelerator identifier */ 869 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr); 724 870 725 871 switch(wID) … … 763 909 764 910 } 765 911 /* Do not use the listview selection anymore */ 912 fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW; 766 913 return 0; 767 914 } … … 851 998 } 852 999 1000 /* List View is selected by default */ 1001 SendDlgItemMessageA(hwnd, IDC_LIST, BM_SETCHECK,(WPARAM) BST_CHECKED,0); 1002 853 1003 return 0; 854 1004 } … … 863 1013 BOOL FILEDLG95_OnOpen(HWND hwnd) 864 1014 { 865 char lpstr FileName[MAX_PATH];1015 char lpstrSpecifiedByUser[MAX_PATH] = ""; 866 1016 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr); 1017 LPITEMIDLIST pidlSelection; 867 1018 868 1019 TRACE("\n"); 869 1020 870 if(GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrFileName,MAX_PATH)) 871 { 872 char *tmp; 873 char lpstrFile[MAX_PATH]; 874 875 /* Get the selected file name and path */ 876 SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent, 877 lpstrFile); 878 if(strcmp(&lpstrFile[strlen(lpstrFile)-1],"\\")) 879 strcat(lpstrFile,"\\"); 880 strcat(lpstrFile,lpstrFileName); 1021 /* Check if there is a selected item in the listview */ 1022 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_USEVIEW) 1023 { 1024 pidlSelection = GetSelectedPidl(fodInfos->Shell.FOIShellView); 1025 GetName(fodInfos->Shell.FOIShellFolder,pidlSelection,SHGDN_NORMAL,lpstrSpecifiedByUser); 1026 COMDLG32_SHFree((LPVOID)pidlSelection); 1027 } 1028 else 1029 /* Get the text from the filename edit */ 1030 GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrSpecifiedByUser,MAX_PATH); 1031 1032 if(strlen(lpstrSpecifiedByUser)) 1033 { 1034 LPSHELLFOLDER psfDesktop; 1035 LPITEMIDLIST browsePidl; 1036 LPSTR lpstrFileSpec; 1037 LPSTR lpstrTemp; 1038 char lpstrPathSpec[MAX_PATH] = ""; 1039 char lpstrCurrentDir[MAX_PATH] = ""; 1040 char lpstrPathAndFile[MAX_PATH] = ""; 1041 1042 /* Separate the file spec from the path spec 1043 e.g.: 1044 lpstrSpecifiedByUser lpstrPathSpec lpstrFileSpec 1045 C:\TEXT1\TEXT2 C:\TEXT1 TEXT2 1046 */ 1047 lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA(lpstrSpecifiedByUser); 1048 strcpy(lpstrPathSpec,lpstrSpecifiedByUser); 1049 COMDLG32_PathRemoveFileSpecA(lpstrPathSpec); 1050 1051 /* Get the current directory name */ 1052 COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent, 1053 lpstrCurrentDir); 1054 1055 /* Create an absolute path name */ 1056 if(lpstrSpecifiedByUser[1] != ':') 1057 { 1058 switch(lpstrSpecifiedByUser[0]) 1059 { 1060 /* Add drive spec \TEXT => C:\TEXT */ 1061 case '\\': 1062 { 1063 INT iCopy = 2; 1064 char lpstrTmp[MAX_PATH] = ""; 1065 if(!strlen(lpstrPathSpec)) 1066 iCopy = 3; 1067 strncpy(lpstrTmp,lpstrCurrentDir,iCopy); 1068 strcat(lpstrTmp,lpstrPathSpec); 1069 strcpy(lpstrPathSpec,lpstrTmp); 1070 } 1071 break; 1072 /* Go to parent ..\TEXT */ 1073 case '.': 1074 { 1075 INT iSize; 1076 char lpstrTmp2[MAX_PATH] = ""; 1077 LPSTR lpstrTmp = strrchr(lpstrCurrentDir,'\\'); 1078 iSize = lpstrTmp - lpstrCurrentDir; 1079 strncpy(lpstrTmp2,lpstrCurrentDir,iSize + 1); 1080 if(strlen(lpstrSpecifiedByUser) <= 3) 1081 strcpy(lpstrFileSpec,""); 1082 if(strcmp(lpstrPathSpec,"..")) 1083 strcat(lpstrTmp2,&lpstrPathSpec[3]); 1084 strcpy(lpstrPathSpec,lpstrTmp2); 1085 } 1086 break; 1087 default: 1088 { 1089 char lpstrTmp[MAX_PATH] = ""; 1090 if(strcmp(&lpstrCurrentDir[strlen(lpstrCurrentDir)-1],"\\")) 1091 strcat(lpstrCurrentDir,"\\"); 1092 strcpy(lpstrTmp,lpstrCurrentDir); 1093 strcat(lpstrTmp,lpstrPathSpec); 1094 strcpy(lpstrPathSpec,lpstrTmp); 1095 } 1096 1097 } /* end switch */ 1098 } 1099 1100 if(strlen(lpstrPathSpec)) 1101 { 1102 /* Browse to the right directory */ 1103 COMDLG32_SHGetDesktopFolder(&psfDesktop); 1104 if((browsePidl = GetPidlFromName(psfDesktop,lpstrPathSpec))) 1105 { 1106 /* Browse to directory */ 1107 IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, 1108 browsePidl, 1109 SBSP_ABSOLUTE); 1110 COMDLG32_SHFree(browsePidl); 1111 } 1112 else 1113 { 1114 /* Path does not exist */ 1115 if(fodInfos->ofnInfos.Flags & OFN_PATHMUSTEXIST) 1116 { 1117 MessageBoxA(hwnd, 1118 "Path does not exist", 1119 fodInfos->ofnInfos.lpstrTitle, 1120 MB_OK | MB_ICONEXCLAMATION); 1121 return FALSE; 1122 } 1123 } 1124 1125 strcat(lpstrPathAndFile,lpstrPathSpec); 1126 IShellFolder_Release(psfDesktop); 1127 } 1128 else 1129 { 1130 strcat(lpstrPathAndFile,lpstrCurrentDir); 1131 } 1132 1133 /* Create the path and file string */ 1134 COMDLG32_PathAddBackslashA(lpstrPathAndFile); 1135 strcat(lpstrPathAndFile,lpstrFileSpec); 1136 1137 /* Update the edit field */ 1138 SetDlgItemTextA(hwnd,IDC_FILENAME,lpstrFileSpec); 1139 SendDlgItemMessageA(hwnd,IDC_FILENAME,EM_SETSEL,0,-1); 1140 1141 /* Don't go further if we dont have a file spec */ 1142 if(!strlen(lpstrFileSpec) || !strcmp(lpstrFileSpec,lpstrPathSpec)) 1143 return FALSE; 1144 1145 /* Time to check lpstrFileSpec */ 1146 /* search => contains * or ? */ 1147 /* browse => contains a directory name */ 1148 /* file => contains a file name */ 881 1149 882 1150 /* Check if this is a search */ 883 if(strchr(lpstrFileName,'*') || strchr(lpstrFileName,'?'))1151 if(strchr(lpstrFileSpec,'*') || strchr(lpstrFileSpec,'?')) 884 1152 { 885 1153 int iPos; … … 889 1157 MemFree((LPVOID)fodInfos->ShellInfos.lpstrCurrentFilter); 890 1158 891 fodInfos->ShellInfos.lpstrCurrentFilter = (LPWSTR)MemAlloc((strlen(lpstrFileName)+1)*2);892 lstrcpyAtoW(fodInfos->ShellInfos.lpstrCurrentFilter,(LPSTR)strlwr((LPSTR)lpstrFileName)); 893 1159 fodInfos->ShellInfos.lpstrCurrentFilter = (LPWSTR)MemAlloc((strlen(lpstrFileSpec)+1)*2); 1160 lstrcpyAtoW(fodInfos->ShellInfos.lpstrCurrentFilter, 1161 (LPSTR)strlwr((LPSTR)lpstrFileSpec)); 894 1162 895 1163 IShellView_Refresh(fodInfos->Shell.FOIShellView); 896 1164 897 if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB,lpstrFileName))) 1165 if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB, 1166 lpstrFileSpec))) 898 1167 CBSetCurSel(fodInfos->DlgInfos.hwndFileTypeCB,iPos); 899 1168 … … 901 1170 } 902 1171 903 /* Check file extension*/904 905 if(!strrchr(lpstrFile,'.'))1172 /* browse if the user specified a directory */ 1173 if((browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder, 1174 lpstrFileSpec))) 906 1175 { 907 /* if the file has no extension, append the selected 908 extension of the filetype combo box */ 909 int iExt; 910 LPSTR lpstrExt; 911 LPSTR lpstrTmp; 912 iExt = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB); 913 lpstrTmp = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iExt); 914 915 if((lpstrExt = strchr(lpstrTmp,';'))) 1176 ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; 1177 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1178 1, 1179 &browsePidl, 1180 &ulAttr); 1181 1182 /* Browse to directory */ 1183 if(ulAttr) 916 1184 { 917 int i = lpstrExt - lpstrTmp; 918 lpstrExt = MemAlloc(i); 919 strncpy(lpstrExt,&lpstrTmp[1],i-1); 1185 if(FAILED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, 1186 browsePidl, 1187 SBSP_RELATIVE))) 1188 { 1189 if(fodInfos->ofnInfos.Flags & OFN_PATHMUSTEXIST) 1190 { 1191 MessageBoxA(hwnd, 1192 "Path does not exist", 1193 fodInfos->ofnInfos.lpstrTitle, 1194 MB_OK | MB_ICONEXCLAMATION); 1195 COMDLG32_SHFree(browsePidl); 1196 return FALSE; 920 1197 } 921 else922 {923 lpstrExt = MemAlloc(strlen(lpstrTmp)-1);924 strcpy(lpstrExt,&lpstrTmp[1]);925 }926 927 if(!strcmp(&lpstrExt[1],"*") && fodInfos->ofnInfos.lpstrDefExt)928 {929 lpstrExt = MemAlloc(strlen(fodInfos->ofnInfos.lpstrDefExt)+1);930 strcat(lpstrExt,".");931 strcat(lpstrExt,(LPSTR) fodInfos->ofnInfos.lpstrDefExt);932 }933 934 strcat(lpstrFile,lpstrExt);935 1198 } 936 /* Check if the selected file exist */ 937 938 if(strlen(lpstrFile) > fodInfos->ofnInfos.nMaxFile) 1199 COMDLG32_SHFree(browsePidl); 1200 return FALSE; 1201 } 1202 COMDLG32_SHFree(browsePidl); 1203 } 1204 else 939 1205 { 940 /* set error FNERR_BUFFERTOSMALL */ 941 FILEDLG95_Clean(hwnd); 942 return EndDialog(hwnd,FALSE); 943 } 944 strcpy(fodInfos->ofnInfos.lpstrFile,lpstrFile); 945 946 /* Set the lpstrFileTitle of the OPENFILENAME structure */ 947 if(fodInfos->ofnInfos.lpstrFileTitle) 948 strncpy(fodInfos->ofnInfos.lpstrFileTitle, 949 lpstrFileName, 950 fodInfos->ofnInfos.nMaxFileTitle); 951 952 /* Check if the file is to be opened as read only */ 953 if(BST_CHECKED == SendDlgItemMessageA(hwnd,IDC_OPENREADONLY,BM_GETSTATE,0,0)) 954 SetFileAttributesA(fodInfos->ofnInfos.lpstrFile,FILE_ATTRIBUTE_READONLY); 955 956 /* nFileExtension and nFileOffset of OPENFILENAME structure */ 957 tmp = strrchr(fodInfos->ofnInfos.lpstrFile,'\\'); 958 fodInfos->ofnInfos.nFileOffset = tmp - fodInfos->ofnInfos.lpstrFile + 1; 959 tmp = strrchr(fodInfos->ofnInfos.lpstrFile,'.'); 960 fodInfos->ofnInfos.nFileExtension = tmp - fodInfos->ofnInfos.lpstrFile + 1; 961 962 /* Check if selected file exists */ 963 if(!GetPidlFromName(fodInfos->Shell.FOIShellFolder, lpstrFileName)) 964 { 1206 /* File does not exist in current directory */ 1207 1208 /* The selected file does not exist */ 965 1209 /* Tell the user the selected does not exist */ 966 1210 if(fodInfos->ofnInfos.Flags & OFN_FILEMUSTEXIST) … … 970 1214 char tmp[400]; 971 1215 972 LoadStringA(COMDLG32_hInstance,IDS_FILENOTFOUND,lpstrNotFound,100); 973 LoadStringA(COMDLG32_hInstance,IDS_VERIFYFILE,lpstrMsg,100); 1216 LoadStringA(COMDLG32_hInstance, 1217 IDS_FILENOTFOUND, 1218 lpstrNotFound, 1219 100); 1220 LoadStringA(COMDLG32_hInstance, 1221 IDS_VERIFYFILE, 1222 lpstrMsg, 1223 100); 974 1224 975 1225 strcpy(tmp,fodInfos->ofnInfos.lpstrFile); … … 979 1229 strcat(tmp,lpstrMsg); 980 1230 981 MessageBoxA(hwnd,tmp,fodInfos->ofnInfos.lpstrTitle,MB_OK | MB_ICONEXCLAMATION); 1231 MessageBoxA(hwnd, 1232 tmp, 1233 fodInfos->ofnInfos.lpstrTitle, 1234 MB_OK | MB_ICONEXCLAMATION); 982 1235 return FALSE; 983 1236 } … … 989 1242 LoadStringA(COMDLG32_hInstance,IDS_CREATEFILE,tmp,100); 990 1243 991 if(IDYES == MessageBoxA(hwnd,tmp,fodInfos->ofnInfos.lpstrTitle,MB_YESNO | MB_ICONQUESTION)) 1244 if(IDYES == MessageBoxA(hwnd,tmp,fodInfos->ofnInfos.lpstrTitle, 1245 MB_YESNO | MB_ICONQUESTION)) 992 1246 { 993 1247 /* Create the file, clean and exit */ … … 998 1252 } 999 1253 } 1254 1255 /* Open the selected file */ 1256 1257 /* Check file extension */ 1258 if(!strrchr(lpstrPathAndFile,'.')) 1259 { 1260 /* if the file has no extension, append the selected 1261 extension of the filetype combo box */ 1262 int iExt; 1263 LPSTR lpstrExt; 1264 iExt = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB); 1265 lpstrTemp = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,iExt); 1266 1267 if((lpstrExt = strchr(lpstrTemp,';'))) 1268 { 1269 int i = lpstrExt - lpstrTemp; 1270 lpstrExt = MemAlloc(i); 1271 strncpy(lpstrExt,&lpstrTemp[1],i-1); 1272 } 1273 else 1274 { 1275 lpstrExt = MemAlloc(strlen(lpstrTemp)); 1276 strcpy(lpstrExt,&lpstrTemp[1]); 1277 } 1278 1279 if(!strcmp(&lpstrExt[1],"*") && fodInfos->ofnInfos.lpstrDefExt) 1280 { 1281 lpstrExt = MemAlloc(strlen(fodInfos->ofnInfos.lpstrDefExt)+2); 1282 strcat(lpstrExt,"."); 1283 strcat(lpstrExt,(LPSTR) fodInfos->ofnInfos.lpstrDefExt); 1284 } 1285 strcat(lpstrPathAndFile,lpstrExt); 1286 } 1287 /* Check that size size of the file does not exceed buffer size */ 1288 if(strlen(lpstrPathAndFile) > fodInfos->ofnInfos.nMaxFile) 1289 { 1290 /* set error FNERR_BUFFERTOSMALL */ 1291 FILEDLG95_Clean(hwnd); 1292 return EndDialog(hwnd,FALSE); 1293 } 1294 strcpy(fodInfos->ofnInfos.lpstrFile,lpstrPathAndFile); 1295 1296 /* Set the lpstrFileTitle of the OPENFILENAME structure */ 1297 if(fodInfos->ofnInfos.lpstrFileTitle) 1298 strncpy(fodInfos->ofnInfos.lpstrFileTitle, 1299 lpstrFileSpec, 1300 fodInfos->ofnInfos.nMaxFileTitle); 1301 1302 /* Check if the file is to be opened as read only */ 1303 if(BST_CHECKED == SendDlgItemMessageA(hwnd, 1304 IDC_OPENREADONLY, 1305 BM_GETSTATE,0,0)) 1306 SetFileAttributesA(fodInfos->ofnInfos.lpstrFile, 1307 FILE_ATTRIBUTE_READONLY); 1308 1309 /* nFileExtension and nFileOffset of OPENFILENAME structure */ 1310 lpstrTemp = strrchr(fodInfos->ofnInfos.lpstrFile,'\\'); 1311 fodInfos->ofnInfos.nFileOffset = lpstrTemp - fodInfos->ofnInfos.lpstrFile + 1; 1312 lpstrTemp = strrchr(fodInfos->ofnInfos.lpstrFile,'.'); 1313 fodInfos->ofnInfos.nFileExtension = lpstrTemp - fodInfos->ofnInfos.lpstrFile + 1; 1314 1315 1000 1316 /* clean and exit */ 1001 1317 FILEDLG95_Clean(hwnd); … … 1024 1340 1025 1341 fodInfos->Shell.FOIShellView = NULL; 1026 if(FAILED( SHGetDesktopFolder(&fodInfos->Shell.FOIShellFolder)))1342 if(FAILED(COMDLG32_SHGetDesktopFolder(&fodInfos->Shell.FOIShellFolder))) 1027 1343 return E_FAIL; 1028 1344 … … 1177 1493 break; 1178 1494 1179 lpstrExt = (LPSTR) MemAlloc(strlen(lpstrExtTmp) );1495 lpstrExt = (LPSTR) MemAlloc(strlen(lpstrExtTmp)+1); 1180 1496 if(!lpstrExt) 1181 1497 break; … … 1230 1546 lpstrFilter = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, 1231 1547 iItem); 1232 if( lpstrFilter)1548 if((INT)lpstrFilter != CB_ERR) 1233 1549 { 1234 1550 fodInfos->ShellInfos.lpstrCurrentFilter = (LPWSTR)MemAlloc((strlen(lpstrFilter)+1)*2); … … 1311 1627 1312 1628 SetPropA(hwndCombo, LookInInfosStr, (HANDLE) liInfos); 1629 CBSetItemHeight(hwndCombo,0,GetSystemMetrics(SM_CYSMICON)); 1313 1630 1314 1631 /* Initialise data of Desktop folder */ 1315 SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidlTmp);1632 COMDLG32_SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidlTmp); 1316 1633 FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND); 1317 SHFree(pidlTmp);1318 1319 SHGetSpecialFolderLocation(0,CSIDL_DRIVES,&pidlDrives);1320 1321 SHGetDesktopFolder(&psfRoot);1634 COMDLG32_SHFree(pidlTmp); 1635 1636 COMDLG32_SHGetSpecialFolderLocation(0,CSIDL_DRIVES,&pidlDrives); 1637 1638 COMDLG32_SHGetDesktopFolder(&psfRoot); 1322 1639 1323 1640 if (psfRoot) … … 1331 1648 1332 1649 /* special handling for CSIDL_DRIVES */ 1333 if ( ILIsEqual(pidlTmp, pidlDrives))1650 if (COMDLG32_PIDL_ILIsEqual(pidlTmp, pidlDrives)) 1334 1651 { 1335 1652 if(SUCCEEDED(IShellFolder_BindToObject(psfRoot, pidlTmp, NULL, &IID_IShellFolder, (LPVOID*)&psfDrives))) … … 1340 1657 while (S_OK == IEnumIDList_Next(lpeDrives, 1, &pidlTmp1, NULL)) 1341 1658 { 1342 pidlAbsTmp = ILCombine(pidlTmp, pidlTmp1);1659 pidlAbsTmp = COMDLG32_PIDL_ILCombine(pidlTmp, pidlTmp1); 1343 1660 FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlAbsTmp,LISTEND); 1344 SHFree(pidlAbsTmp);1345 SHFree(pidlTmp1);1661 COMDLG32_SHFree(pidlAbsTmp); 1662 COMDLG32_SHFree(pidlTmp1); 1346 1663 } 1347 1664 IEnumIDList_Release(lpeDrives); … … 1350 1667 } 1351 1668 } 1352 SHFree(pidlTmp);1669 COMDLG32_SHFree(pidlTmp); 1353 1670 } 1354 1671 IEnumIDList_Release(lpeRoot); … … 1357 1674 1358 1675 IShellFolder_Release(psfRoot); 1359 SHFree(pidlDrives);1676 COMDLG32_SHFree(pidlDrives); 1360 1677 1361 1678 return NOERROR; … … 1394 1711 if(pDIStruct->itemID == liInfos->uSelectedItem) 1395 1712 { 1396 ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,1713 ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem, 1397 1714 0, 1398 1715 &sfi, … … 1404 1721 else 1405 1722 { 1406 ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,1723 ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem, 1407 1724 0, 1408 1725 &sfi, … … 1431 1748 { 1432 1749 iIndentation = 0; 1433 ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,1750 ilItemImage = (HIMAGELIST) COMDLG32_SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem, 1434 1751 0, 1435 1752 &sfi, … … 1495 1812 iItem = CBGetCurSel(fodInfos->DlgInfos.hwndLookInCB); 1496 1813 1497 tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB, 1498 iItem); 1814 if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB, 1815 iItem))) 1816 return FALSE; 1499 1817 1500 1818 … … 1537 1855 /* Calculate the indentation of the item in the lookin*/ 1538 1856 pidlNext = pidl; 1539 while( (pidlNext= ILGetNext(pidlNext)) )1857 while( (pidlNext=COMDLG32_PIDL_ILGetNext(pidlNext)) ) 1540 1858 { 1541 1859 tmpFolder->m_iIndent++; 1542 1860 } 1543 1861 1544 tmpFolder->pidlItem = ILClone(pidl);1862 tmpFolder->pidlItem = COMDLG32_PIDL_ILClone(pidl); 1545 1863 1546 1864 if(tmpFolder->m_iIndent > liInfos->iMaxIndentation) 1547 1865 liInfos->iMaxIndentation = tmpFolder->m_iIndent; 1548 1866 1549 SHGetFileInfoA((LPSTR)pidl,1867 COMDLG32_SHGetFileInfoA((LPSTR)pidl, 1550 1868 0, 1551 1869 &sfi, … … 1598 1916 1599 1917 /* Free pidlParent memory */ 1600 SHFree((LPVOID)pidlParent);1918 COMDLG32_SHFree((LPVOID)pidlParent); 1601 1919 1602 1920 return FILEDLG95_LOOKIN_AddItem(hwnd,pidl,iParentPos + 1); … … 1693 2011 LPSFOLDER tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,i); 1694 2012 1695 if(iSearchMethod == SEARCH_PIDL && ILIsEqual((LPITEMIDLIST)searchArg,tmpFolder->pidlItem))2013 if(iSearchMethod == SEARCH_PIDL && COMDLG32_PIDL_ILIsEqual((LPITEMIDLIST)searchArg,tmpFolder->pidlItem)) 1696 2014 return i; 1697 2015 if(iSearchMethod == SEARCH_EXP && tmpFolder->m_iIndent == (int)searchArg) … … 1750 2068 { 1751 2069 HRESULT hRes; 1752 SHGetDesktopFolder(&lpsf);2070 COMDLG32_SHGetDesktopFolder(&lpsf); 1753 2071 hRes = GetName(lpsf,pidl,dwFlags,lpstrFileName); 1754 2072 IShellFolder_Release(lpsf); … … 1762 2080 &str))) 1763 2081 { 1764 return StrRetToStrNA(lpstrFileName, MAX_PATH, &str, pidl);2082 return StrRetToBufA(&str, pidl,lpstrFileName, MAX_PATH); 1765 2083 } 1766 2084 return E_FAIL; … … 1779 2097 TRACE("%p\n", pidlAbs); 1780 2098 1781 if(SUCCEEDED( SHGetDesktopFolder(&psfParent)))2099 if(SUCCEEDED(COMDLG32_SHGetDesktopFolder(&psfParent))) 1782 2100 { 1783 2101 psf = psfParent; 1784 2102 if(pidlAbs && pidlAbs->mkid.cb) 1785 2103 { 1786 if( FAILED(IShellFolder_BindToObject(psfParent, pidlAbs, NULL, &IID_IShellFolder, (LPVOID*)&psf)))2104 if(SUCCEEDED(IShellFolder_BindToObject(psfParent, pidlAbs, NULL, &IID_IShellFolder, (LPVOID*)&psf))) 1787 2105 { 1788 psf = NULL; 2106 IShellFolder_Release(psfParent); 2107 return psf; 1789 2108 } 1790 2109 } 1791 IShellFolder_Release(psfParent); 1792 } 1793 1794 return psf; 1795 2110 /* return the desktop */ 2111 return psfParent; 2112 } 2113 return NULL; 1796 2114 } 1797 2115 … … 1807 2125 TRACE("%p\n", pidl); 1808 2126 1809 pidlParent = ILClone(pidl);1810 ILRemoveLastID(pidlParent);1811 2127 pidlParent = COMDLG32_PIDL_ILClone(pidl); 2128 COMDLG32_PIDL_ILRemoveLastID(pidlParent); 2129 1812 2130 return pidlParent; 1813 1814 2131 } 1815 2132 … … 1825 2142 ULONG ulEaten; 1826 2143 wchar_t lpwstrDirName[MAX_PATH]; 2144 1827 2145 1828 2146 TRACE("sf=%p file=%s\n", psf, lpcstrFileName); … … 1838 2156 MAX_PATH); 1839 2157 1840 1841 1842 if(SUCCEEDED(IShellFolder_ParseDisplayName(psf, 1843 0, 2158 IShellFolder_ParseDisplayName(psf, 0, 1844 2159 NULL, 1845 2160 (LPWSTR)lpwstrDirName, 1846 2161 &ulEaten, 1847 2162 &pidl, 1848 NULL)))1849 { 2163 NULL); 2164 1850 2165 return pidl; 1851 }1852 return NULL;1853 2166 } 1854 2167
Note:
See TracChangeset
for help on using the changeset viewer.