![]() |
Desktop Development »
Shell and IE programming »
General
Beginner
Open Containing Folder for Windows 98By byblostasShell extension invoked for files found within Windows 98 Find: Files and Folders engine |
VC6, ATL, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||

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.
IContextMenu methods.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!
| You must Sign In to use this message board. | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 21 Jul 2002 Editor: James Spibey |
Copyright 2002 by byblostas Everything else Copyright © CodeProject, 1999-2009 Web13 | Advertise on the Code Project |