Click here to Skip to main content
6,293,171 members and growing! (11,909 online)
Email Password   helpLost your password?
Desktop Development » Shell and IE programming » General     Beginner

Open Containing Folder for Windows 98

By byblostas

Shell extension invoked for files found within Windows 98 Find: Files and Folders engine
VC6, ATL, Dev
Posted:21 Jul 2002
Views:46,395
Bookmarked:9 times
Announcements
Loading...
 
Search    
Advanced Search
printPrint   Broken Article?Report       add Share
  Discuss Discuss   Recommend Article Email
5 votes for this article.
Popularity: 3.26 Rating: 4.67 out of 5

1

2

3
1 vote, 25.0%
4
3 votes, 75.0%
5

Open Containing folder

Motivation

I used to work a lot on Windows 98 and had always felt that it lacked some features which were available on Windows 2000, ME and XP. This feature enables opening containing folder for any item found by MS Search engine on these OS versions. I have modified the code presented by Michael Dunn in his Complete Idiot's Guide to Writing Shell Extensions - I to enable this feature for Windows 98 too.

How It Works

  1. This context menu handler is enabled for any shell object and is invoked on mouse right-click.
  2. If current active window's caption starts with Find: - Explorer initializes our extension and calls IContextMenu methods.
  3. As we implement InvokeCommand() - ShellExecute(...) API to run explorer.exe to select this item (file or folder). For this specific task we may use command line template supported by explorer.exe: /select,full_path_to_file. For a detailed description on using these parameters refer to MSDN Q152457.

Again, most of this code had been already presented by Mike, so you may just modify some of his code.

These are the lines to be added to Initialize() method implementation ...

    ...
    ...
    HWND	hActiveWnd	= ::GetActiveWindow();
    TCHAR	szFindWnd[]	= "Find:";
    TCHAR	szCaption[MAX_PATH];
    GetWindowText(hActiveWnd, szCaption, sizeof(szFindWnd));
	
    if (0 != lstrcmp(szCaption, szFindWnd))
		hr = E_INVALIDARG;
    ...
    ...		

Modify the QueryContextMenu() method implementation to insert the proper menu item...

    ...
    ...
    InsertMenu(hMenu, uMenuIndex, MF_BYPOSITION, uidFirstCmd, 
                                 _T("Open co&ntaining folder..."));	
    ...
    ...		

And these are the lines to be modified in InvokeCommand() method implementation ...

    ...
    ...
    if (0 == LOWORD(pCmdInfo->lpVerb))
    {
        TCHAR	szCmdLine[MAX_PATH + 32] = "/select,";
        lstrcat(szCmdLine, m_szFile);

        ShellExecute(pCmdInfo->hwnd, _T("Open"), _T("Explorer"), szCmdLine, 
                                                        NULL, SW_SHOWDEFAULT);
        return S_OK;
    }
    ...
    ...		

You may need to register this handler for windows shell object Folder to enable this feature for folders as well.

    ...
    ...
    NoRemove Folder
    {
        NoRemove ShellEx
        {
	    NoRemove ContextMenuHandlers
            {
                ForceRemove FoundInFolder = 
                                       s '{204F12AD-9B6A-11D6-B613-A43CF34AB54C}'
            }
        }
    }
    ...
    ...		

This handler has effect on Windows 98 only, since other versions use modified engine to run searching. Enjoy!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

byblostas


Member

Occupation: Web Developer
Location: Israel Israel

Other popular Shell and IE programming articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 7 of 7 (Total in Forum: 7) (Refresh)FirstPrevNext
GeneralFYI: Still works properly in Win2k PinmemberPaul Farry3:08 30 Jan '03  
GeneralIsn't this on the File Menu? PinmemberSimon Capewell6:07 29 Jul '02  
GeneralRe: Isn't this on the File Menu? Pinmemberbyblos13:26 29 Jul '02  
GeneralRe: Isn't this on the File Menu? PinmemberSimon Capewell23:48 29 Jul '02  
GeneralOnly shortcuts PinmemberThomas Freudenberg3:19 22 Jul '02  
GeneralRe: Only shortcuts Pinmemberbyblos4:28 22 Jul '02  
GeneralRe: Only shortcuts PinmemberThomas Freudenberg5:26 22 Jul '02  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 21 Jul 2002
Editor: James Spibey
Copyright 2002 by byblostas
Everything else Copyright © CodeProject, 1999-2009
Web16 | Advertise on the Code Project