rekire rekire - 2 months ago 15
C++ Question

Writing namespace extensions with Windows 7 integration

I'm new to the topic shell extensions and I'm looking for resources about namespace extensions. I would like to write a namespace extension which supports SFTP with all options to browse like FTP in the explorer.

I read the examples 1, 2 of zengxi from codeproject, but they don't compile right and seems to be old. I think that there were also many changes like the folder selection in the address bar.

Can somebody provide me some resources in the right direction or some working examples?

UPDATE:
It is important that the source is free. This is a non-profit project.

At the moment I found a good source on the MSDN called Explorer Data Provider Sample. This is up to date and provides some aliases

Explorer Data Provider
and
Shell Data Source
. What is yet missing is drop & drag support and a glue for supporting protocol links.

For future usage it would be great to find a way to associate a file extension with that
shell data source
like zip files.

Answer

For Drag&Drop, this series of articles are a great point to start. After I understood that the files must have the flag can copy, can move, etc. I had almost the solution. The magic was to add one line in GetAttributesOf:

*rgfInOut |= SFGAO_CANCOPY|SFGAO_CANMOVE;

Also I had to publish the IDataObject in GetUIObjectOf like this:

if(riid == IID_IDataObject) {
    PWSTR pszName;
    hr = _GetName(apidl[0], &pszName);
    hr = SHCreateDataObject(m_pidl, cidl, apidl,
                            new CFileDataObject(pszName), riid, ppv);
} else if(riid == IID_IDropTarget) {
    // TODO publish
    return E_NOINTERFACE;
}

That's all.

By the way what is the best practice for allocating CFileDataObject here?

Comments