Changeset 6645 for trunk/src/comdlg32/filedlgbrowser.c
- Timestamp:
 - Sep 5, 2001, 2:14:25 PM (24 years ago)
 - File:
 - 
      
- 1 edited
 
- 
          
  trunk/src/comdlg32/filedlgbrowser.c (modified) (41 diffs)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
trunk/src/comdlg32/filedlgbrowser.c
r5583 r6645 1 /* $Id: filedlgbrowser.c,v 1.9 2001-09-05 12:12:01 bird Exp $ */ 1 2 /* 2 3 * Implementation of IShellBrowser for the File Open common dialog 3 * 4 * 4 5 * 5 6 */ … … 59 60 * External Prototypes 60 61 */ 61 extern const char *FileOpenDlgInfosStr; 62 extern const char *FileOpenDlgInfosStr; 62 63 63 64 extern HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl,DWORD dwFlags,LPSTR lpstrFileName); … … 91 92 static HRESULT COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl) 92 93 { 93 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);94 95 switch (src->uType)96 {97 case STRRET_WSTR:98 lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);99 COMDLG32_SHFree(src->u.pOleStr);100 break;101 102 case STRRET_CSTRA:94 TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl); 95 96 switch (src->uType) 97 { 98 case STRRET_WSTR: 99 lstrcpynW((LPWSTR)dest, src->u.pOleStr, len); 100 COMDLG32_SHFree(src->u.pOleStr); 101 break; 102 103 case STRRET_CSTRA: 103 104 if (len && !MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, (LPWSTR)dest, len )) 104 105 ((LPWSTR)dest)[len-1] = 0; 105 break;106 107 case STRRET_OFFSETA:108 if (pidl)109 {106 break; 107 108 case STRRET_OFFSETA: 109 if (pidl) 110 { 110 111 if (len && !MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, 111 112 -1, (LPWSTR)dest, len )) 112 113 ((LPWSTR)dest)[len-1] = 0; 113 }114 break;115 116 default:117 FIXME("unknown type!\n");118 if (len)119 { *(LPWSTR)dest = '\0';120 }121 return(FALSE);122 }123 return S_OK;114 } 115 break; 116 117 default: 118 FIXME("unknown type!\n"); 119 if (len) 120 { *(LPWSTR)dest = '\0'; 121 } 122 return(FALSE); 123 } 124 return S_OK; 124 125 } 125 126 126 127 /* 127 * IShellBrowser128 * IShellBrowser 128 129 */ 129 130 130 131 /************************************************************************** 131 132 * IShellBrowserImpl_Construct … … 158 159 */ 159 160 HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface, 160 REFIID riid, 161 REFIID riid, 161 162 LPVOID *ppvObj) 162 163 { … … 168 169 169 170 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 170 { *ppvObj = This; 171 { *ppvObj = This; 171 172 } 172 173 else if(IsEqualIID(riid, &IID_IOleWindow)) /*IOleWindow*/ … … 215 216 TRACE("(%p)\n", This); 216 217 217 if (!--(This->ref)) 218 { 218 if (!--(This->ref)) 219 { 219 220 HeapFree(GetProcessHeap(),0, This); 220 221 return 0; … … 235 236 * 236 237 * Note : We will never be window less in the File Open dialog 237 * 238 */ 239 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, 238 * 239 */ 240 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, 240 241 HWND * phwnd) 241 242 { … … 249 250 *phwnd = This->hwndOwner; 250 251 251 return (*phwnd) ? S_OK : E_UNEXPECTED; 252 return (*phwnd) ? S_OK : E_UNEXPECTED; 252 253 253 254 } … … 276 277 * See Windows documentation on IShellBrowser::BrowseObject for more details 277 278 * 278 * This function will override user specified flags and will always 279 * use SBSP_DEFBROWSER and SBSP_DEFMODE. 280 */ 281 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, 282 LPCITEMIDLIST pidl, 279 * This function will override user specified flags and will always 280 * use SBSP_DEFBROWSER and SBSP_DEFMODE. 281 */ 282 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, 283 LPCITEMIDLIST pidl, 283 284 UINT wFlags) 284 285 { … … 301 302 if(wFlags & SBSP_RELATIVE) 302 303 { 303 304 304 305 /* SBSP_RELATIVE A relative pidl (relative from the current folder) */ 305 306 if(FAILED(hRes = IShellFolder_BindToObject(fodInfos->Shell.FOIShellFolder, … … 307 308 { 308 309 ERR("bind to object failed\n"); 309 return hRes;310 return hRes; 310 311 } 311 312 /* create an absolute pidl */ … … 326 327 psfTmp = GetShellFolderFromPidl(pidlTmp); 327 328 } 328 329 329 330 if(!psfTmp) 330 331 { … … 333 334 } 334 335 335 /* If the pidl to browse to is equal to the actual pidl ... 336 /* If the pidl to browse to is equal to the actual pidl ... 336 337 do nothing and pretend you did it*/ 337 338 if(COMDLG32_PIDL_ILIsEqual(pidlTmp,fodInfos->ShellInfos.pidlAbsCurrent)) 338 339 { 339 340 IShellFolder_Release(psfTmp); 340 COMDLG32_SHFree(pidlTmp);341 COMDLG32_SHFree(pidlTmp); 341 342 TRACE("keep current folder\n"); 342 343 return NOERROR; … … 395 396 396 397 /* changes the tab order of the ListView to reflect the window's File Dialog */ 397 hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN); 398 hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN); 398 399 SetWindowPos(hwndView, hDlgWnd, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE); 399 400 … … 402 403 SetFocus(fodInfos->ShellInfos.hwndView); 403 404 404 return hRes; 405 return hRes; 405 406 error: 406 407 ERR("Failed with error 0x%08lx\n", hRes); … … 411 412 * IShellBrowserImpl_EnableModelessSB 412 413 */ 413 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface, 414 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface, 414 415 BOOL fEnable) 415 416 416 417 { 417 418 ICOM_THIS(IShellBrowserImpl, iface); … … 426 427 * IShellBrowserImpl_GetControlWindow 427 428 */ 428 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface, 429 UINT id, 429 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface, 430 UINT id, 430 431 HWND *lphwnd) 431 432 432 433 { 433 434 ICOM_THIS(IShellBrowserImpl, iface); … … 442 443 */ 443 444 HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface, 444 DWORD grfMode, 445 DWORD grfMode, 445 446 LPSTREAM *ppStrm) 446 447 447 448 { 448 449 ICOM_THIS(IShellBrowserImpl, iface); … … 452 453 /* Feature not implemented */ 453 454 return E_NOTIMPL; 454 } 455 } 455 456 /************************************************************************** 456 457 * IShellBrowserImpl_InsertMenusSB … … 459 460 HMENU hmenuShared, 460 461 LPOLEMENUGROUPWIDTHS lpMenuWidths) 461 462 462 463 { 463 464 ICOM_THIS(IShellBrowserImpl, iface); … … 473 474 HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface, 474 475 IShellView *ppshv) 475 476 { 477 ICOM_THIS(IShellBrowserImpl, iface); 478 479 TRACE("(%p)\n", This); 480 481 /* Feature not implemented */ 482 return E_NOTIMPL; 483 } 476 477 { 478 ICOM_THIS(IShellBrowserImpl, iface); 479 480 TRACE("(%p)\n", This); 481 482 /* Feature not implemented */ 483 return E_NOTIMPL; 484 } 484 485 /************************************************************************** 485 486 * IShellBrowserImpl_QueryActiveShellView … … 487 488 HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface, 488 489 IShellView **ppshv) 489 490 490 491 { 491 492 ICOM_THIS(IShellBrowserImpl, iface); … … 503 504 IShellView_AddRef(fodInfos->Shell.FOIShellView); 504 505 return NOERROR; 505 } 506 } 506 507 /************************************************************************** 507 508 * IShellBrowserImpl_RemoveMenusSB … … 509 510 HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface, 510 511 HMENU hmenuShared) 511 512 { 513 ICOM_THIS(IShellBrowserImpl, iface); 514 515 TRACE("(%p)\n", This); 516 517 /* Feature not implemented */ 518 return E_NOTIMPL; 519 } 512 513 { 514 ICOM_THIS(IShellBrowserImpl, iface); 515 516 TRACE("(%p)\n", This); 517 518 /* Feature not implemented */ 519 return E_NOTIMPL; 520 } 520 521 /************************************************************************** 521 522 * IShellBrowserImpl_SendControlMsg 522 523 */ 523 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface, 524 UINT id, 525 UINT uMsg, 526 WPARAM wParam, 524 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface, 525 UINT id, 526 UINT uMsg, 527 WPARAM wParam, 527 528 LPARAM lParam, 528 529 LRESULT *pret) 529 530 530 531 { 531 532 ICOM_THIS(IShellBrowserImpl, iface); 532 533 LRESULT lres; 533 534 534 535 TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret); 535 536 … … 538 539 case FCW_TOOLBAR: 539 540 lres = SendDlgItemMessageA( This->hwndOwner, IDC_TOOLBAR, uMsg, wParam, lParam); 540 break;541 break; 541 542 default: 542 543 FIXME("ctrl id: %x\n", id); … … 550 551 */ 551 552 HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface, 552 HMENU hmenuShared, 553 HMENU hmenuShared, 553 554 HOLEMENU holemenuReserved, 554 555 HWND hwndActiveObject) 555 556 { 557 ICOM_THIS(IShellBrowserImpl, iface); 558 559 TRACE("(%p)\n", This); 560 561 /* Feature not implemented */ 562 return E_NOTIMPL; 563 } 556 557 { 558 ICOM_THIS(IShellBrowserImpl, iface); 559 560 TRACE("(%p)\n", This); 561 562 /* Feature not implemented */ 563 return E_NOTIMPL; 564 } 564 565 /************************************************************************** 565 566 * IShellBrowserImpl_SetStatusTextSB … … 567 568 HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface, 568 569 LPCOLESTR lpszStatusText) 569 570 { 571 ICOM_THIS(IShellBrowserImpl, iface); 572 573 TRACE("(%p)\n", This); 574 575 /* Feature not implemented */ 576 return E_NOTIMPL; 577 } 570 571 { 572 ICOM_THIS(IShellBrowserImpl, iface); 573 574 TRACE("(%p)\n", This); 575 576 /* Feature not implemented */ 577 return E_NOTIMPL; 578 } 578 579 /************************************************************************** 579 580 * IShellBrowserImpl_SetToolbarItems 580 581 */ 581 582 HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface, 582 LPTBBUTTON lpButtons, 583 UINT nButtons, 583 LPTBBUTTON lpButtons, 584 UINT nButtons, 584 585 UINT uFlags) 585 586 { 587 ICOM_THIS(IShellBrowserImpl, iface); 588 589 TRACE("(%p)\n", This); 590 591 /* Feature not implemented */ 592 return E_NOTIMPL; 593 } 586 587 { 588 ICOM_THIS(IShellBrowserImpl, iface); 589 590 TRACE("(%p)\n", This); 591 592 /* Feature not implemented */ 593 return E_NOTIMPL; 594 } 594 595 /************************************************************************** 595 596 * IShellBrowserImpl_TranslateAcceleratorSB 596 597 */ 597 598 HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface, 598 LPMSG lpmsg, 599 LPMSG lpmsg, 599 600 WORD wID) 600 601 601 602 { 602 603 ICOM_THIS(IShellBrowserImpl, iface); … … 644 645 */ 645 646 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface( 646 ICommDlgBrowser *iface,647 REFIID riid, 648 LPVOID *ppvObj)647 ICommDlgBrowser *iface, 648 REFIID riid, 649 LPVOID *ppvObj) 649 650 { 650 651 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface); … … 693 694 TRACE("(%p)\n", This); 694 695 695 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); 696 696 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); 697 697 698 /* If the selected object is not a folder, send a IDOK command to parent window */ 698 699 if((pidl = GetPidlFromDataObject(fodInfos->Shell.FOIDataObject, 1))) … … 702 703 ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; 703 704 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr); 704 if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) )705 {705 if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) ) 706 { 706 707 hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE); 707 }708 } 708 709 else 709 {710 { 710 711 /* Tell the dialog that the user selected a file */ 711 hRes = PostMessageA(This->hwndOwner, WM_COMMAND, IDOK, 0L);712 }712 hRes = PostMessageA(This->hwndOwner, WM_COMMAND, IDOK, 0L); 713 } 713 714 714 715 /* Free memory used by pidl */ … … 737 738 case CDBOSC_SETFOCUS: 738 739 /* FIXME: Reset the default button. 739 This should be taken care of by defdlg. If control740 other than button receives focus the default button741 should be restored. */740 This should be taken care of by defdlg. If control 741 other than button receives focus the default button 742 should be restored. */ 742 743 SendMessageA(This->hwndOwner, DM_SETDEFID, IDOK, 0); 743 744 744 745 break; 745 case CDBOSC_KILLFOCUS: 746 {747 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);748 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)749 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");746 case CDBOSC_KILLFOCUS: 747 { 748 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); 749 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) 750 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save"); 750 751 } 751 752 break; … … 753 754 return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface,ppshv); 754 755 case CDBOSC_RENAME: 755 /* nothing to do */756 /* nothing to do */ 756 757 break; 757 758 } 758 759 759 return NOERROR; 760 return NOERROR; 760 761 } 761 762 … … 763 764 * IShellBrowserImpl_ICommDlgBrowser_IncludeObject 764 765 */ 765 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface, 766 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface, 766 767 IShellView * ppshv, 767 768 LPCITEMIDLIST pidl) … … 780 781 ulAttr = SFGAO_HIDDEN | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR | SFGAO_LINK; 781 782 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr); 782 783 783 784 if( (ulAttr & SFGAO_HIDDEN) /* hidden */ 784 785 | !(ulAttr & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR))) /* special folder */ … … 786 787 787 788 /* always include directorys and links */ 788 if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK)) 789 if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK)) 789 790 return S_OK; 790 791 … … 797 798 if (SUCCEEDED(COMDLG32_StrRetToStrNW(szPathW, MAX_PATH, &str, pidl))) 798 799 { 799 if (PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter))800 if (PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter)) 800 801 return S_OK; 801 802 } … … 807 808 /************************************************************************** 808 809 * IShellBrowserImpl_ICommDlgBrowser_OnSelChange 809 */ 810 */ 810 811 HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv) 811 812 { … … 816 817 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); 817 818 TRACE("(%p do=%p view=%p)\n", This, fodInfos->Shell.FOIDataObject, fodInfos->Shell.FOIShellView); 818 819 819 820 /* release old selections */ 820 821 if (fodInfos->Shell.FOIDataObject) 821 822 IDataObject_Release(fodInfos->Shell.FOIDataObject); 822 823 823 824 /* get a new DataObject from the ShellView */ 824 825 if(FAILED(IShellView_GetItemObject(fodInfos->Shell.FOIShellView, SVGIO_SELECTION, 825 826 &IID_IDataObject, (LPVOID*)&fodInfos->Shell.FOIDataObject))) 826 827 return E_FAIL; 827 828 828 829 FILEDLG95_FILENAME_FillFromSelection(This->hwndOwner); 829 830 … … 856 857 */ 857 858 HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryInterface( 858 IServiceProvider *iface,859 REFIID riid, 860 LPVOID *ppvObj)859 IServiceProvider *iface, 860 REFIID riid, 861 LPVOID *ppvObj) 861 862 { 862 863 _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface); … … 895 896 * 896 897 * NOTES 897 * the w2k shellview asks for 898 * the w2k shellview asks for 898 899 * guidService = SID_STopLevelBrowser 899 900 * riid = IShellBrowser … … 904 905 905 906 HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryService( 906 IServiceProvider * iface,907 REFGUID guidService,908 REFIID riid,909 void** ppv)907 IServiceProvider * iface, 908 REFGUID guidService, 909 REFIID riid, 910 void** ppv) 910 911 { 911 912 _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  