2 * Implementation of IShellBrowser for the File Open common dialog
9 #include "filedlgbrowser.h"
12 #include "wine/obj_dataobject.h"
13 #include "debugtools.h"
15 #include "wine/undocshell.h"
17 DEFAULT_DEBUG_CHANNEL(commdlg)
19 #define SETDefFormatEtc(fe,cf,med) \
22 (fe).dwAspect = DVASPECT_CONTENT; \
29 /**************************************************************************
32 static ICOM_VTABLE(IShellBrowser) IShellBrowserImpl_Vtbl =
35 IShellBrowserImpl_QueryInterface,
36 IShellBrowserImpl_AddRef,
37 IShellBrowserImpl_Release,
39 IShellBrowserImpl_GetWindow,
40 IShellBrowserImpl_ContextSensitiveHelp,
42 IShellBrowserImpl_InsertMenusSB,
43 IShellBrowserImpl_SetMenuSB,
44 IShellBrowserImpl_RemoveMenusSB,
45 IShellBrowserImpl_SetStatusTextSB,
46 IShellBrowserImpl_EnableModelessSB,
47 IShellBrowserImpl_TranslateAcceleratorSB,
48 IShellBrowserImpl_BrowseObject,
49 IShellBrowserImpl_GetViewStateStream,
50 IShellBrowserImpl_GetControlWindow,
51 IShellBrowserImpl_SendControlMsg,
52 IShellBrowserImpl_QueryActiveShellView,
53 IShellBrowserImpl_OnViewWindowActive,
54 IShellBrowserImpl_SetToolbarItems
57 static ICOM_VTABLE(ICommDlgBrowser) IShellBrowserImpl_ICommDlgBrowser_Vtbl =
60 IShellBrowserImpl_ICommDlgBrowser_QueryInterface,
61 IShellBrowserImpl_ICommDlgBrowser_AddRef,
62 IShellBrowserImpl_ICommDlgBrowser_Release,
64 IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand,
65 IShellBrowserImpl_ICommDlgBrowser_OnStateChange,
66 IShellBrowserImpl_ICommDlgBrowser_IncludeObject
70 /**************************************************************************
74 HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv);
76 LPITEMIDLIST GetSelectedPidl(IShellView *ppshv);
79 /**************************************************************************
82 extern const char *FileOpenDlgInfosStr;
84 extern HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl,DWORD dwFlags,LPSTR lpstrFileName);
85 extern HRESULT GetFileName(HWND hwnd, LPITEMIDLIST pidl, LPSTR lpstrFileName);
86 extern IShellFolder* GetShellFolderFromPidl(LPITEMIDLIST pidlAbs);
87 extern LPITEMIDLIST GetParentPidl(LPITEMIDLIST pidl);
88 extern LPITEMIDLIST GetPidlFromName(IShellFolder *psf,LPCSTR lpcstrFileName);
90 extern BOOL FILEDLG95_SHELL_FillIncludedItemList(HWND hwnd,
91 LPITEMIDLIST pidlCurrentFolder,
94 extern int FILEDLG95_LOOKIN_SelectItem(HWND hwnd,LPITEMIDLIST pidl);
95 extern BOOL FILEDLG95_OnOpen(HWND hwnd);
96 extern HRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode);
99 /**************************************************************************
100 * IShellBrowserImpl_Construct
102 IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner)
104 IShellBrowserImpl *sb;
105 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwndOwner,FileOpenDlgInfosStr);
107 sb=(IShellBrowserImpl*)SHAlloc(sizeof(IShellBrowserImpl));
109 /* Initialisation of the member variables */
111 sb->hwndOwner = hwndOwner;
113 /* Initialisation of the vTables */
114 sb->lpVtbl = &IShellBrowserImpl_Vtbl;
115 sb->lpVtbl2 = &IShellBrowserImpl_ICommDlgBrowser_Vtbl;
117 COMDLG32_SHGetSpecialFolderLocation(hwndOwner,
119 &fodInfos->ShellInfos.pidlAbsCurrent);
123 return (IShellBrowser *) sb;
126 /**************************************************************************
129 * The INTERFACE of the IShellBrowser object
137 /***************************************************************************
138 * IShellBrowserImpl_QueryInterface
140 HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
144 ICOM_THIS(IShellBrowserImpl, iface);
146 TRACE("(%p)\n", This);
150 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
153 else if(IsEqualIID(riid, &IID_IOleWindow)) /*IOleWindow*/
154 { *ppvObj = (IOleWindow*)This;
157 else if(IsEqualIID(riid, &IID_IShellBrowser)) /*IShellBrowser*/
158 { *ppvObj = (IShellBrowser*)This;
161 else if(IsEqualIID(riid, &IID_ICommDlgBrowser)) /*ICommDlgBrowser*/
162 { *ppvObj = (ICommDlgBrowser*) &(This->lpVtbl2);
166 { IUnknown_AddRef( (IShellBrowser*) *ppvObj);
169 return E_NOINTERFACE;
172 /**************************************************************************
173 * IShellBrowser::AddRef
175 ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser * iface)
177 ICOM_THIS(IShellBrowserImpl, iface);
179 TRACE("(%p)\n", This);
181 return ++(This->ref);
184 /**************************************************************************
185 * IShellBrowserImpl_Release
187 ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
189 ICOM_THIS(IShellBrowserImpl, iface);
191 TRACE("(%p)\n", This);
195 COMDLG32_SHFree(This);
205 /**************************************************************************
206 * IShellBrowserImpl_GetWindow (IOleWindow)
208 * Inherited from IOleWindow::GetWindow
210 * See Windows documentation for more details
212 * Note : We will never be window less in the File Open dialog
215 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface,
218 ICOM_THIS(IShellBrowserImpl, iface);
220 TRACE("(%p)\n", This);
225 *phwnd = This->hwndOwner;
227 return (*phwnd) ? S_OK : E_UNEXPECTED;
231 /**************************************************************************
232 * IShellBrowserImpl_ContextSensitiveHelp
234 HRESULT WINAPI IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser * iface,
237 ICOM_THIS(IShellBrowserImpl, iface);
239 TRACE("(%p)\n", This);
241 /* Feature not implemented */
249 /**************************************************************************
250 * IShellBrowserImpl_BrowseObject
252 * See Windows documentation on IShellBrowser::BrowseObject for more details
254 * This function will override user specified flags and will always
255 * use SBSP_DEFBROWSER and SBSP_DEFMODE.
257 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
262 IShellFolder *psfTmp;
264 FileOpenDlgInfos *fodInfos;
265 LPITEMIDLIST pidlTmp;
267 ICOM_THIS(IShellBrowserImpl, iface);
269 TRACE("(%p)\n", This);
271 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
273 /* Format the pidl according to its parameter's category */
274 if(wFlags & SBSP_RELATIVE)
277 /* SBSP_RELATIVE A relative pidl (relative from the current folder) */
278 hRes = IShellFolder_BindToObject(fodInfos->Shell.FOIShellFolder,
287 /* create an absolute pidl */
288 pidlTmp = COMDLG32_PIDL_ILCombine(fodInfos->ShellInfos.pidlAbsCurrent,
292 else if(wFlags & SBSP_PARENT)
294 /* Browse the parent folder (ignores the pidl) */
296 pidlTmp = GetParentPidl(fodInfos->ShellInfos.pidlAbsCurrent);
297 psfTmp = GetShellFolderFromPidl(pidlTmp);
302 /* An absolute pidl (relative from the desktop) */
303 pidlTmp = COMDLG32_PIDL_ILClone((LPITEMIDLIST)pidl);
304 psfTmp = GetShellFolderFromPidl(pidlTmp);
308 /* Retrieve the IShellFolder interface of the pidl specified folder */
312 /* If the pidl to browse to is equal to the actual pidl ...
313 do nothing and pretend you did it*/
314 if(COMDLG32_PIDL_ILIsEqual(pidlTmp,fodInfos->ShellInfos.pidlAbsCurrent))
316 IShellFolder_Release(psfTmp);
317 COMDLG32_SHFree(pidlTmp);
321 /* Release the current fodInfos->Shell.FOIShellFolder and update its value */
322 IShellFolder_Release(fodInfos->Shell.FOIShellFolder);
323 fodInfos->Shell.FOIShellFolder = psfTmp;
325 /* Create the associated view */
326 if(SUCCEEDED(hRes = IShellFolder_CreateViewObject(psfTmp,
327 fodInfos->ShellInfos.hwndOwner,
332 /* Get the foldersettings from the old view */
333 if(fodInfos->Shell.FOIShellView)
335 IShellView_GetCurrentInfo(fodInfos->Shell.FOIShellView,
336 &fodInfos->ShellInfos.folderSettings);
339 /* Create the window */
340 if(SUCCEEDED(hRes = IShellView_CreateViewWindow(psvTmp,
342 &fodInfos->ShellInfos.folderSettings,
343 fodInfos->Shell.FOIShellBrowser,
344 &fodInfos->ShellInfos.rectView,
347 /* Fit the created view in the appropriate RECT */
349 fodInfos->ShellInfos.rectView.left,
350 fodInfos->ShellInfos.rectView.top,
351 fodInfos->ShellInfos.rectView.right-fodInfos->ShellInfos.rectView.left,
352 fodInfos->ShellInfos.rectView.bottom-fodInfos->ShellInfos.rectView.top,
355 /* Select the new folder in the Look In combo box of the Open file dialog */
357 FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,pidlTmp);
359 /* Release old pidlAbsCurrent memory and update its value */
360 COMDLG32_SHFree((LPVOID)fodInfos->ShellInfos.pidlAbsCurrent);
361 fodInfos->ShellInfos.pidlAbsCurrent = pidlTmp;
363 /* Release the current fodInfos->Shell.FOIShellView and update its value */
364 if(fodInfos->Shell.FOIShellView)
366 IShellView_DestroyViewWindow(fodInfos->Shell.FOIShellView);
367 IShellView_Release(fodInfos->Shell.FOIShellView);
370 ShowWindow(fodInfos->ShellInfos.hwndView,SW_HIDE);
372 fodInfos->Shell.FOIShellView = psvTmp;
374 fodInfos->ShellInfos.hwndView = hwndView;
380 FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,fodInfos->ShellInfos.pidlAbsCurrent);
384 /**************************************************************************
385 * IShellBrowserImpl_EnableModelessSB
387 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,
391 ICOM_THIS(IShellBrowserImpl, iface);
393 TRACE("(%p)\n", This);
395 /* Feature not implemented */
399 /**************************************************************************
400 * IShellBrowserImpl_GetControlWindow
402 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,
407 ICOM_THIS(IShellBrowserImpl, iface);
409 TRACE("(%p)\n", This);
411 /* Feature not implemented */
414 /**************************************************************************
415 * IShellBrowserImpl_GetViewStateStream
417 HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
422 ICOM_THIS(IShellBrowserImpl, iface);
424 TRACE("(%p)\n", This);
426 /* Feature not implemented */
429 /**************************************************************************
430 * IShellBrowserImpl_InsertMenusSB
432 HRESULT WINAPI IShellBrowserImpl_InsertMenusSB(IShellBrowser *iface,
434 LPOLEMENUGROUPWIDTHS lpMenuWidths)
437 ICOM_THIS(IShellBrowserImpl, iface);
439 TRACE("(%p)\n", This);
441 /* Feature not implemented */
444 /**************************************************************************
445 * IShellBrowserImpl_OnViewWindowActive
447 HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
451 ICOM_THIS(IShellBrowserImpl, iface);
453 TRACE("(%p)\n", This);
455 /* Feature not implemented */
458 /**************************************************************************
459 * IShellBrowserImpl_QueryActiveShellView
461 HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface,
465 ICOM_THIS(IShellBrowserImpl, iface);
467 FileOpenDlgInfos *fodInfos;
469 TRACE("(%p)\n", This);
471 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
473 if(!(*ppshv = fodInfos->Shell.FOIShellView))
477 IShellView_AddRef(fodInfos->Shell.FOIShellView);
480 /**************************************************************************
481 * IShellBrowserImpl_RemoveMenusSB
483 HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface,
487 ICOM_THIS(IShellBrowserImpl, iface);
489 TRACE("(%p)\n", This);
491 /* Feature not implemented */
494 /**************************************************************************
495 * IShellBrowserImpl_SendControlMsg
497 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,
505 ICOM_THIS(IShellBrowserImpl, iface);
508 TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret);
513 lres = SendDlgItemMessageA( This->hwndOwner, IDC_TOOLBAR, uMsg, wParam, lParam);
516 FIXME("ctrl id: %x\n", id);
519 if (pret) *pret = lres;
522 /**************************************************************************
523 * IShellBrowserImpl_SetMenuSB
525 HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
527 HOLEMENU holemenuReserved,
528 HWND hwndActiveObject)
531 ICOM_THIS(IShellBrowserImpl, iface);
533 TRACE("(%p)\n", This);
535 /* Feature not implemented */
538 /**************************************************************************
539 * IShellBrowserImpl_SetStatusTextSB
541 HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
542 LPCOLESTR lpszStatusText)
545 ICOM_THIS(IShellBrowserImpl, iface);
547 TRACE("(%p)\n", This);
549 /* Feature not implemented */
552 /**************************************************************************
553 * IShellBrowserImpl_SetToolbarItems
555 HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
556 LPTBBUTTON lpButtons,
561 ICOM_THIS(IShellBrowserImpl, iface);
563 TRACE("(%p)\n", This);
565 /* Feature not implemented */
568 /**************************************************************************
569 * IShellBrowserImpl_TranslateAcceleratorSB
571 HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
576 ICOM_THIS(IShellBrowserImpl, iface);
578 TRACE("(%p)\n", This);
580 /* Feature not implemented */
588 /***************************************************************************
589 * IShellBrowserImpl_ICommDlgBrowser_QueryInterface
591 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(ICommDlgBrowser *iface,
595 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface);
597 TRACE("(%p)\n", This);
599 return IShellBrowserImpl_QueryInterface(This,riid,ppvObj);
602 /**************************************************************************
603 * IShellBrowserImpl_ICommDlgBrowser_AddRef
605 ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_AddRef(ICommDlgBrowser * iface)
607 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface);
609 TRACE("(%p)\n", This);
611 return IShellBrowserImpl_AddRef(This);
614 /**************************************************************************
615 * IShellBrowserImpl_ICommDlgBrowser_Release
617 ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_Release(ICommDlgBrowser * iface)
619 _ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface);
621 TRACE("(%p)\n", This);
623 return IShellBrowserImpl_Release(This);
625 /**************************************************************************
626 * IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand
628 * Called when a user double-clicks in the view or presses the ENTER key
630 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDlgBrowser *iface,
634 FileOpenDlgInfos *fodInfos;
636 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
638 TRACE("(%p)\n", This);
640 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
642 /* If the selected object is not a folder, send a IDOK command to parent window */
643 if((pidl = GetSelectedPidl(ppshv)))
647 ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
648 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
650 hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE);
651 /* Tell the dialog that the user selected a file */
654 hRes = FILEDLG95_OnOpen(This->hwndOwner);
657 /* Free memory used by pidl */
658 COMDLG32_SHFree((LPVOID)pidl);
666 /**************************************************************************
667 * IShellBrowserImpl_ICommDlgBrowser_OnStateChange
669 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser *iface,
674 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
676 TRACE("(%p)\n", This);
680 case CDBOSC_SETFOCUS:
682 case CDBOSC_KILLFOCUS:
684 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
685 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
686 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
689 case CDBOSC_SELCHANGE:
690 return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface,ppshv);
697 /**************************************************************************
698 * IShellBrowserImpl_ICommDlgBrowser_IncludeObject
700 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface,
704 FileOpenDlgInfos *fodInfos;
707 WCHAR szPathW[MAX_PATH];
709 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
711 TRACE("(%p)\n", This);
713 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
715 ulAttr = SFGAO_HIDDEN | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR | SFGAO_LINK;
716 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
719 if( (ulAttr & SFGAO_HIDDEN) /* hidden */
720 | !(ulAttr & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR))) /* special folder */
722 /* always include directorys and links */
723 if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK))
725 /* Check if there is a mask to apply if not */
726 if(!fodInfos->ShellInfos.lpstrCurrentFilter ||
727 !lstrlenW(fodInfos->ShellInfos.lpstrCurrentFilter))
730 if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_FORPARSING, &str)))
731 { if (SUCCEEDED(StrRetToBufW(&str, pidl,szPathW, MAX_PATH)))
733 if (COMDLG32_PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter))
741 /**************************************************************************
742 * IShellBrowserImpl_ICommDlgBrowser_OnSelChange
744 HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv)
747 FileOpenDlgInfos *fodInfos;
748 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
750 fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
751 TRACE("(%p)\n", This);
753 if((pidl = GetSelectedPidl(ppshv)))
755 HRESULT hRes = E_FAIL;
756 char lpstrFileName[MAX_PATH];
758 ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
759 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
762 if(SUCCEEDED(hRes = GetName(fodInfos->Shell.FOIShellFolder,pidl,SHGDN_NORMAL,lpstrFileName)))
763 SetWindowTextA(fodInfos->DlgInfos.hwndFileName,lpstrFileName);
764 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
765 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
768 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Open");
770 fodInfos->DlgInfos.dwDlgProp |= FODPROP_USEVIEW;
772 COMDLG32_SHFree((LPVOID)pidl);
773 SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE);
776 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
777 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
779 fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW;
783 /***********************************************************************
786 * Return the pidl of the first selected item in the view
788 LPITEMIDLIST GetSelectedPidl(IShellView *ppshv)
791 IDataObject *doSelected;
792 LPITEMIDLIST pidlSelected = NULL;
794 TRACE("sv=%p\n", ppshv);
796 /* Get an IDataObject from the view */
797 if(SUCCEEDED(IShellView_GetItemObject(ppshv,
800 (LPVOID *)&doSelected)))
805 /* Set the FORMATETC structure*/
806 SETDefFormatEtc(formatetc,
807 RegisterClipboardFormatA(CFSTR_SHELLIDLIST),
810 /* Get the pidl from IDataObject */
811 if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium)))
813 LPIDA cida = GlobalLock(medium.u.hGlobal);
814 TRACE("cida=%p\n", cida);
815 pidlSelected = COMDLG32_PIDL_ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[1]]));
817 if(medium.pUnkForRelease)
818 IUnknown_Release(medium.pUnkForRelease);
821 GlobalUnlock(medium.u.hGlobal);
822 GlobalFree(medium.u.hGlobal);
825 IDataObject_Release(doSelected);