|
-
Oct 21st, 2014, 11:44 AM
#1
Re: [VB6] Using the new IFileOperation interface to replace SHFileOperation on Vista+
Appendix
Here's how the interface is added in as VB-accessable:
Code:
[
odl,
uuid(947aab5f-0a5c-4c13-b4d6-4bf7836fc9f8),
]
interface IFileOperation : stdole.IUnknown
{
// 1) (Optional) Set up your event sink.
[helpstring("Not implemented. Needs IFileOperationProgressSink class module implementation.")]
HRESULT Advise([in] void *pfops, [out] LONG *pdwCookie);
HRESULT Unadvise([in] LONG dwCookie);
// 2) Set operation state
// FOF_ flags (defined in shellapi.h) and FOFX_ flags are passed here
// if not specified the default flags are FOF_ALLOWUNDO | FOF_NOCONFIRMMKDIR
HRESULT SetOperationFlags([in] FILEOP_FLAGS dwOperationFlags);
HRESULT SetProgressMessage([in] LPCWSTR pszMessage);
HRESULT SetProgressDialog([in] IOperationsProgressDialog *popd);
HRESULT SetProperties([in] IPropertyChangeArray *pproparray);
HRESULT SetOwnerWindow([in] LONG hwndOwner);
// 3) Specify operations to take on given items.
// FooItem takes an IShellItem*.
// FooItems takes an IShellItem*, an IEnumShellItems* or an IDataObject*.
HRESULT ApplyPropertiesToItem([in] IShellItem *psiItem);
HRESULT ApplyPropertiesToItems([in] IUnknown *punkItems);
HRESULT RenameItem(
[in] IShellItem *psiItem,
[in] LPCWSTR pszNewName,
[in] void *pfopsItem); //IFileOperationProgressSink
[helpstring("punkItems is either IShellItemArray, IEnumShellItems, or IDataObject")]
HRESULT RenameItems(
[in] IUnknown *pUnkItems,
[in] LPCWSTR pszNewName);
HRESULT MoveItem(
[in] IShellItem *psiItem,
[in] IShellItem *psiDestinationFolder,
[in] LPCWSTR pszNewName,
[in] void *pfopsItem); //IFileOperationProgressSink
[helpstring("punkItems is either IShellItemArray, IEnumShellItems, or IDataObject")]
HRESULT MoveItems(
[in] IUnknown *punkItems,
[in] IShellItem *psiDestinationFolder);
HRESULT CopyItem(
[in] IShellItem *psiItem,
[in] IShellItem *psiDestinationFolder,
[in] LPCWSTR pszCopyName,
[in] void *pfopsItem);
[helpstring("punkItems is either IShellItemArray, IEnumShellItems, or IDataObject")]
HRESULT CopyItems(
[in] IUnknown *punkItems,
[in] IShellItem *psiDestinationFolder);
HRESULT DeleteItem(
[in] IShellItem *psiItem,
[in] void *pfopsItem);
[helpstring("punkItems is either IShellItemArray, IEnumShellItems, or IDataObject")]
HRESULT DeleteItems([in] IUnknown *punkItems);
HRESULT NewItem(
[in] IShellItem *psiDestinationFolder,
[in] LONG dwFileAttributes,
[in] LPCWSTR pszName,
[in] LPCWSTR pszTemplateName,
[in] void *pfopsItem);
// 4) Perform operations.
HRESULT PerformOperations();
// 5) Were any operations aborted?
HRESULT GetAnyOperationsAborted([out] LONG *pfAnyOperationsAborted);
}
Interfaces that aren't mandatory and not yet implemented by me are left as void *, which translates to As Any in VB. Types are converted into ones that are understood by VB.
Last edited by fafalone; Oct 21st, 2014 at 11:48 AM.
-
Jan 13th, 2015, 07:47 AM
#2
Member
Re: [VB6] Using the new IFileOperation interface to replace SHFileOperation on Vista+
Hi fafalone,
great job, thanks a lot!
Question: Why did you change the definition of interface IDataObject in dataobj.inc? This breaks some of my code using the original olelib.tlb.
Original:
LONG GetData(
[in, out] FORMATETC *pformatetcIn,
[in, out] STGMEDIUM *pmedium);
New:
HRESULT GetData(
[in] FORMATETC *pformatetcIn,
[in,out] STGMEDIUM *pmedium);
I'm using GetData as a function, but with the new olelib.tlb it#s just a sub.
Thanks,
voxy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|