Access violation when using IShellFolder2

FreeSlave freeslave93 at gmail.com
Wed Sep 9 22:44:50 UTC 2020


On Wednesday, 9 September 2020 at 07:18:04 UTC, John Chapman 
wrote:
> On Tuesday, 8 September 2020 at 22:24:22 UTC, FreeSlave wrote:
>> However if I change the type of recycleBin variable to 
>> IShellFolder (not IShellFolder2), the crash does not happen.
>>
>> Does IShellFolder2 require some special handling?
>
> The issue is caused by druntime's definition of IShellFolder2. 
> To fix it temporarily, just redefine it in your module 
> somewhere:
>
> interface IShellFolder2 : IShellFolder {
>   HRESULT GetDefaultSearchGUID(GUID*);
>   HRESULT EnumSearches(IEnumExtraSearch*);
>   HRESULT GetDefaultColumn(DWORD, ULONG*, ULONG*);
>   HRESULT GetDefaultColumnState(UINT, SHCOLSTATEF*);
>   HRESULT GetDetailsEx(LPCITEMIDLIST, const(SHCOLUMNID)*, 
> VARIANT*);
>   HRESULT GetDetailsOf(LPCITEMIDLIST, UINT, SHELLDETAILS*);
>   HRESULT MapColumnToSCID(UINT, SHCOLUMNID*);
> }
>
> IShellFolder2 isn't the only culprit - IShellView2 will need 
> fixing too if you intend to use it. There are probably others 
> as well.

Redefinition did the trick, thank you.

Btw do you know how to parse a date returned by GetDetailsOf? 
Couldn't find any examples in C++. I actually can see digits 
representing date and time as a part of the string, but I would 
prefer to use some winapi function to translate it into some time 
type instead of manually parsing the result.


More information about the Digitalmars-d-learn mailing list