Programmatically select multiple files in windows explorer

This should be possible with the shell function SHOpenFolderAndSelectItems EDIT Here is some sample code showing how to use the function in C/C++, without error checking: //Directory to open ITEMIDLIST *dir = ILCreateFromPath(_T(“C:\\”)); //Items in directory to select ITEMIDLIST *item1 = ILCreateFromPath(_T(“C:\\Program Files\\”)); ITEMIDLIST *item2 = ILCreateFromPath(_T(“C:\\Windows\\”)); const ITEMIDLIST* selection[] = {item1,item2}; UINT count = … Read more

How to use IFileOperation from ctypes

Sure, it’s located in pythoncom and shell for constants, for example: from win32com.shell import shell import pythoncom # create an instance of IFileOperation fo = pythoncom.CoCreateInstance(shell.CLSID_FileOperation, None, pythoncom.CLSCTX_ALL, shell.IID_IFileOperation) # here you can use SetOperationFlags, progress Sinks, etc. # create an instance of IShellItem for the source item item1 = shell.SHCreateItemFromParsingName(“c:\\temp\\source.txt”, None, shell.IID_IShellItem) # create … Read more

Windows shell extension with C#

A Raymond’s post: Do not write in-process shell extensions in managed code. A recent follow-up: Now that version 4 of the .NET Framework supports in-process side-by-side runtimes, is it now okay to write shell extensions in managed code? The bottom line is, no, it is not okay: The Guidance for implementing in-process extensions has been … Read more

C# get thumbnail from file via windows api

Ran across this today — it’s a few months old, but it got the job done for me (on Win7, extracting thumbnails on MPEG-4 files): Source : https://github.com/dbarros/WindowsAPICodePack Nuget : https://www.nuget.org/packages/WindowsAPICodePack-Shell Code: ShellFile shellFile = ShellFile.FromFilePath(pathToYourFile); Bitmap shellThumb = shellFile.Thumbnail.ExtraLargeBitmap; Hope it helps!