|
Alternatively, it looks like IShellBrowser::BrowseObject( ) is called when you double-click on a folder. However, it won't call it normally. Instead I needed to extend my IShellBrowser object to also have the IServiceProvider interface, and then return an IShellBrowser interface when requested.
When you double-click on a folder, it looks like the IShellView first calls IServiceProvier::QueryService( ) for an IShellBrowser interface, and if it finds it it invokes IShellBrowser::BrowseObject( ) with the PIDL of the new folder and does nothing (ie, waits for you to open the new folder). If you don't implement IServiceProvider (or don't return an IShellBrowser from QueryService ), it looks like IShellView just launches a whole new Windows Explorer to display the new folder.
I haven't implemented same-window navigation yet, but I expect to just create a new IShellView using the PIDL supplied in BrowseObject , and then swap the child's new window with the parent folder's IShellView window. I could even keep around the old IShellView to speed up the "Back" function, or destroy and recreate it later. We'll see.
-david
|
|
|
|
|
Hey David, Thanks alot. Finally i get to work now.
RickyV
|
|
|
|
|
Hi
I also need to implement the same functionality.
How did u implement that.
Cud you pls give me any pointers in this regard
Thanking you
Rohini
|
|
|
|
|
i still don't know how to implement it.
WTL
|
|
|
|
|
Hello RickyV:
i saw you reply in "Implementing IShellBrowser to host IShellView", and knew that you had implement the feature "display the contents of the folder in a single windows".
Could you give me some advice about how to implement it.
Thank you very much!
/////////////////
Yibo Xu
BeiJing China
http://www.xuyibo.org
WTL
|
|
|
|
|
I am writing a new shell namespace and I would like to expand the folder programatically. Is there a way to do it ?
For example, when explorer is first displayed, I would like to have my root name space expands to at least one lvel down.
Thanks
|
|
|
|
|
Hi. I'm hosting the View Windows in a ListView Control, but I cannot retrieve selected items as they are not ListView elements. Is there any way to get selected items ? Thanks.
K-ballo
|
|
|
|
|
IShellView::GetItemObject(SVGIO_SELECTION...)
Then see what formats are available and do GetData.
Look into CFSTR_SHELLIDLIST format
|
|
|
|
|
After 4 Years, this stuff is still useful !
cheers Guys, very helpfull stuff
|
|
|
|
|
It's a great article.
Thanks.
I have one question.
How to get a pointer of IShellBrowser in MFC application?
|
|
|
|
|
You have to implement IShellBrowser like in the sample unless you're writting a namespace extension, then it's different. In that case Windows Explorer implements it nd passes it to your extension.
http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_adv/namespaceextension/nse_works.asp
|
|
|
|
|
Hi, I was just wondering if it would be possible to do a custom sort on the items in the list view. Thanks!
|
|
|
|
|
Is it possible to implement the IShellBrowser in C#?
How is this done?
|
|
|
|
|
>>I didn't try to merge the menus.
>>Things I couldn't get to work:
>>Toolbar buttons (they were added to my toolbar, but bitmaps were messed up). They do function however.
Wonderful job! And a question:
I am trying to merge the menus and toolbar buttons, but feel frustrated. Can I do it simply by implementing InsertMenusSB and SetMenuSB? How to implement these methods?
Can you send me a sample or some information on internet? (vicluck@hotmail.com)
Thanks a lot for your hard work.
|
|
|
|
|
This sample is missing the atlapp.h file, I've searched my VC7 directories and cannot find it anywhere?
Thanks
|
|
|
|
|
|
Hello Sir,
I'm doing the prog. to protect folder by passwords.
I tried to Implement IShellFolder interface. But I couldn't
Can you help me?
Sumathi
Suamthi
|
|
|
|
|
Hello,
You have to find docs/articles on Shell Namespace Extensions:
http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_extending/extending.asp
http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_extending/extensionhandlers/shell_ext.asp
etc etc
Thanx
|
|
|
|
|
Just throw this code into OnStateChange like this:
STDMETHODIMP CMainFrame::OnStateChange(IShellView *ppshv, ULONG uChange)
{
if ( uChange == CDBOSC_SELCHANGE )
{
CIDA *cida;
LPVOID info;
if ( ppshv->GetItemObject(SVGIO_SELECTION, IID_IDataObject, &info) == S_OK )
{
UINT cfFormat = RegisterClipboardFormat(CFSTR_SHELLIDLIST);
FORMATETC fmtetc = { cfFormat, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
STGMEDIUM stgmed;
IDataObject *data = (IDataObject*)info;
if ( data->GetData(&fmtetc, &stgmed) == S_OK )
{
cida = (CIDA*)stgmed.hGlobal;
// If only one file is selected
if ( cida->cidl == 1 )
{
LPCITEMIDLIST pidlDirectory = (LPCITEMIDLIST)(((LPBYTE)cida) + cida->aoffset[0]);
LPCITEMIDLIST pidlFile = (LPCITEMIDLIST)(((LPBYTE)cida) + cida->aoffset[1]);
LPCITEMIDLIST pidl = Pidl_Concatenate(pidlDirectory, pidlFile);
//do something with pidl (I just threw in a messagebox)
char path[MAX_PATH];
SHGetPathFromIDList(pidl, path);
MessageBox(path, path, MB_OK);
}
}
}
}
}
|
|
|
|
|
Hi, Leon.
Thanks for you excellent work!
I want to know if the way you do is same as some other software like CJLib or BCGControlBar's CShellList.
How do the func:
HRESULT CreateViewWindow(<br />
IShellView *psvPrevious,<br />
LPCFOLDERSETTINGS pfs,<br />
IShellBrowser *psb,<br />
RECT *prcView,<br />
HWND *phWnd);
work, and how to use the last param phWnd. This point is a out param. but how to use it to create a window.
thanks for you response.
By the way, may you happy!
|
|
|
|
|
Hi,
You don't need to use last HWND param to create the window.
The last HWND param is returned back to us by CreateViewWindow.
It already creates fully functional window and gives us back hwnd to it
so that we can manipulate it in our application.
It's class name is SHELLDLL_DefView. This window serves as the parent
of ListView control, which has all the files/etc.
You can use this hwnd in MoveWindow for example to position it in your
application or for any other reason that applies.
I hope that helps
Thanx a lot!
|
|
|
|
|
Hi:
Very glad to your reply!
I find that many people can't compile the example at the first times. And me too.;P And now, I can't yet. Oh, I am so stupid. Haha... Because I am a beginner and rarely use WTL.
I wonder that why I can't get the right result use follow steps directly (Code as follow is a mini example):
LPSHELLFOLDER lpsf = NULL;<br />
SHGetDesktopFolder( &lpsf );<br />
IShellView lpsView;<br />
lpsf->CreateViewObject( m_hWnd, IID_IShellView, &lpsView );<br />
lpsView->CreateViewWindow( xxx );
I expect that you can supply a more simple example to us, so I can't continue my FTP program works.
Thanx a lot!
Best wish to you!
|
|
|
|
|
Hello,
It's not that simple to create the example,
because you have to implement IShellBrowser interface
and if needed ICommDlgBrowser.
class IShellBrowserImpl : public IShellBrowser, public ICommDlgBrowser
{
...
};
This instance of IShellBrowser class has to be passed to CreateViewWindow
for the 3rd parameter.
If you want your statusbar to get the info messages about the selected files
you have to provide your statusbar hwnd also in one of the override methods.
Then you also have to respond differently to WM_GETISHELLBROWSER in your parent window
when it's dialog or simple window.
These are basic steps.
Maybe you can tell me what error you're getting with wtl and I can help you with that.
For WTL7 you need to download:
http://www.microsoft.com/downloads/details.aspx?familyid=128E26EE-2112-4CF7-B28E-7727D9A1F288&displaylang=en
Then just set the VC's include path to where you installed wtl7. For example, [X:\YourPath\]wtl7\Include
If you don't have VS.NET, you need to download Platform SDK:
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
After that, the project should build without any errors.
Another way to provide similar GUI is by hosting WebBrowser ActiveX control.
Here is a complete example with source code:
http://support.microsoft.com/default.aspx?scid=189634
|
|
|
|
|
Hi:
Very very thank you for your reply!
I will try with your mothod. I cann't implement immidiately because my OS is WINXP now so I cann't install SDK! I will success at last!
Thanx again! You are so kindly!
Happy everyday!
|
|
|
|
|
Hi, Leon.
I thank you that all your artcles are very useful
(we can find your article using "leon finker" with google.)
Is there a way to notify folder changing?
This is a step I did.
1) Execute winexplore.exe
2) Create new folder on the Desktop.
3) The new folder 2) doesn't appear on Treeview of winexplore.exe
(If I close all item(show only Desktop on Treeview pane)
and expand all item , the new folder appear.)
I want to treeview to notify folder changing(create, new, rename)
automaticaly.
Thanks.
From Hiro
|
|
|
|