windows-shell

How can I create my custom Shell Context Handlers for Windows?

Problem Language: C# 2.0 or later I would like to register context handlers to create menues when the user right clicks certain files (in my case *.eic). What is the procedure to register, unregister (clean up) and handle events (clicks) from these menues? I have a clue it's something to do with the windows registry, but considering...

Tasklist CPU % usage

I'm trying to use tasklist to find out which process is consuming more than X percent of my CPU (to later kill it with taskkill.) How do I know what percent does a time format represents? The documentations says: TASKLIST options /FI filter And one filter may be: CPUTIME eq, ne, gt, lt, ge, le CPU...

Extracting Icon/Thumbnail for a file

Hi, I want to extract the Icon/Thumbnail (different size) of a file from windows shell on my project. I am able to extract the thumbnail with out any issue, but the problem came when working with files that don't have thumbnail view. The issue is I am not able to get the bitmap as the windows explorer shows. I am getting a black color wh...

How to detect launching from a "Startup"-folder shortcut?

I need to add the "Run when Windows starts" option to my program CintaNotes, but do not want to sacrifice the "cleanness" of it: it is a 100% portable freeware and should not leave traces in the system. I've come up with the idea to autodetect running from the Startup shortcut and automatically minimizing to the system tray. Is there a w...

cmd script that fails when text is found

In the windows shell: echo "foo bar" | find "foo" succeeds (i.e. errorlevel = 0). However, I want a script that fails (i.e. errorlevel <> 0) when it finds a particular word in some input text. Any ideas? ...

What happened to the Group by, Sort by, Stack by Column Header Context Menu in Windows 7 RC?

As a dev I normally group my explorer detail view by file type. This way all the config files, assemblies, executables etc are grouped and ready to be copied, just by clicking its group header to select all related files. In beta build 7000 one could hold Ctrl and select many groups to select all the related files. IMO since RC build 7...

Is there a way to resolve a .lnk target that works for links that end up in c:\windows\installer ?

The usual way to resolve lnk involve using WShell.WshShortcut or IShellLink that way : var WshShell = WScript.CreateObject("WScript.Shell"); var oShellLink = WshShell.CreateShortcut(strDesktop + "\\some-shortcut.lnk"); WScript.Echo(oShellLink.TargetPath) But there are links that can't be resolved that way : the resolution end up in c:...

Fastest way to get the extension name and icon by an file extension?

Hi, There are several approaches to fetch the description and default icon for a given extension (no full path), e.g for "*.doc" I want to get "Microsoft Word Document" and the related icon, which do you think will be the fastest one of the following: Search the registry: in registry, go to "HKCR.{extension}", read the default valu...

How to add a shortcut to the 'SendTo' menu that will be available to all users.

You can add a new item to the 'Send To' Windows explorer menu by creating an application shortcut in the SendTo folder contained in the user's profile folder e.g. C:\Documents and Settings\Username\SendTo\ But how do you add a 'Send To' menu item that will be available to all users without having to add it to every user's profile folder...

Why can't I find the #define for CSIDL_PROFILES?

I am trying to use SHGetFolderPath() to determine the path of the user profiles folder. The documentation states that CSIDL_PROFILES defines this folder: CSIDL_PROFILES (0x003e) Version 6.0. The file system directory containing user profile folders. A typical path is C:\Documents and Settings. I am using Visual Studio 2005 SP1, and I c...

How to get a LPITEMIDLIST pointer according to the path of a folder?

I want to get the system icon of a specified folder, but maybe the only way to retrieve the icon is to use SHGetFileInfo() method. The first parameter of SHGetFileInfo() method is a pointer of LPITEMIDLIST. If I only have the absolute path of the folder, how can I get the pointer according to the path? Thank you very much! ...

Can't read file summary properties in windows after reading them in code using Shell interop

After reading a file properties in code in a fashion similar to this, I go to the file in question using Windows Explorer and can't read the file summary properties. Am I missing something in my code? How do I release file handles possibly held by the Shell object? ...

C# get thumbnail from file via windows api

Windows explorer has the ability to show thumbnails of files. These thumbnails are provided by core and third-party shell extensions. I know how to extend the shell to provide thumbnails to Windows. What I want to do is retrieve the thumbnail image from any file on the system via the shell using C#. Is this possible? Essentially, I'm ...

How to run ShellExecute on shell object clsid ?

Shell explorer on Windows define global objects such as ::{2559a1f4-21d7-11d4-bdaf-00c04f60b9f0 which is a link to the user "internet browser". I got these value from a shortcut that is drag&dropped over my application, but I can't find how to use it to open it... I'd like to get information about what this object is too. Does someo...

How to Execute/ShellExecuteEx/InvokeCommand ITEMIDLIST pointing to Shell objects ?

I'm building a kind of dock, and I struggle at finding how to save things like "Run", "Search", "Help", "Printers" and reopen them after that. I tried this : CComPtr<IShellFolder> pDF; SHGetDesktopFolder(&pDF); LPITEMIDLIST pidlPrintersAndFaxes=0; hr=pDF->ParseDisplayName(0, 0, L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3...

CFSTR_FILEDESCRIPTOR/CFSTR_FILECONTENTS 'Copying Files' Dialog missing

Hi, I have a namespace extension that supports copy-paste using the CFSTR_FILEDESCRIPTOR/ CFSTR_FILECONTENTS to copy virtual files to the clipboard. However, the 'Copying Files...' progress dialog does not show up. Explorer appears to hang until the copy operation is complete. Any suggestions as to how to get the progress dialog to w...

How to implement IExplorerBrowser in MFC

Apparently, there's a fairly easy way to host Explorer in your app starting with Vista: http://www.codeproject.com/KB/vista/ExplorerBrowser.aspx However, that interface is only available starting with Vista. I see that there is another way to do it: "going all the way back to 95, but it requires more work - implement IExplorerBrowser a...

Should an implementor of IShellBrowser::QueryActiveShellView Method call AddRef for the caller?

I am attempting to implement an IShellBrowser. One method of such is: HRESULT STDMETHODCALLTYPE IShellBrowser::QueryActiveShellView(/* [out] */ __RPC__deref_out_opt IShellView **ppshv) This gets the active shell view pointer for the caller (in my case, there is only one shell view at any given time). But it is very unclear whether I...

Is there an OS function to translate a REFIID to a helpful name?

Short of writing a function manually that translates a few known REFIID to names, such as: if (riid == IID_IUnknown) return "IUnknown"; if (riid == IID_IShellBrowser) return "IShellBrowser"; ... Is there a system call that would return a reasonable debugging string for well-known (or even all) REFIIDs? ...

Does anyone know where I can find the standard windows file dialog toolbar icons?

I'm trying to roll my own implementation of IShellBrowser because I need to have a more full-featured File Open and Save As dialog than Windows allows that is compatible with XP (and ideally with W2000)* At this point I need to add the standard toolbar that you see in upper right of the dialog (manifest styles for XP and earlier) - a ba...