Answer the question
In order to leave comments, you need to log in
Create a Windows Explorer extension. How can I find out the parameters of a file?
I am creating an extension for Explorer. By right-clicking on a file/selected files and choosing my menu item, you need to write the file name, size and creation date of the file to the file. By what means can you find out these file parameters (the name must be without the full path)?
Answer the question
In order to leave comments, you need to log in
Implement the Initialize method of the IShellExtInit interface, get the path to the files in it:
HRESULT STDMETHODCALLTYPE XXX::Initialize(
LPCITEMIDLIST pidlFolder,
LPDATAOBJECT lpdobj,
HKEY hkeyProgID)
{
STGMEDIUM medium;
FORMATETC fe = {CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
if(SUCCEEDED(lpdobj->GetData(&fe,&medium))) {
UINT n = DragQueryFile((HDROP)medium.hGlobal,~0,NULL,0);
for (UINT i = 0; i < n; ++i) {
char filePath[MAX_PATH];
DragQueryFile((HDROP)medium.hGlobal,i,filePath,MAX_PATH);
printf("%s\n", filePath);
}
ReleaseStgMedium(&medium);
}
return S_OK;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question