|
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
|
|
|
|
|
Hi, Hiro!
There is a way to detect changes on Windows 2000+ (maybe win9x?)
Thanx to Tim Tabor who showed an implementation
for his "shell spy" sample before the appropriate functions
were even documented on MSDN:
http://www.cheztabor.com/ShellSpy/index.htm
SHChangeNotifyRegister/SHChangeNotifyDeregister
Another (untested) way might be to watch for changes with
ReadDirectoryChangesW/FindFirstChangeNotification. But if you
want to watch al drives this might not be a good idea. Using the
shell events is much better.
Thanx a lot!
|
|
|
|
|
Hi, Leon.
First, I thank you for your reply.
SHChangeNotifyRegister/SHChangeNotifyDeregister !!!!
I can do what I wanted to do at last.
Thank you very much!!
From hiro.
#I'm looking forward to your new article. Thanks.
|
|
|
|
|
the reason for it is that in
FOLDERSETTINGS fs;
fields are filled incorrectly (they are swapped). Confusion come from
Microsoft online help that is vague and confusing about it.
Correct order is:
fs.fFlags = FWF_SNAPTOGRID|FWF_NOCLIENTEDGE|FWF_BESTFITWINDOW|FWF_ALIGNLEFT;
fs.ViewMode = FVM_THUMBNAIL;
Happy coding.
Leo
|
|
|
|
|
Hello,
That's good to know.
Thanx for the info!
|
|
|
|
|
when another directory is selected, the thumbnail display isn't kept. try with "large icons", "small icons", "list" or "details" displays, those ones are well and truly kept, but not the thumbnail display.
how to correct this please ?
note : thumbnail display is only available on windows 2000 and later.
|
|
|
|
|
Hi,
when you use IShellView::SaveViewState(), what happen??
I dont know how to do it, because Ive never try it.
|
|
|
|
|
I get the same problem, anyone found an answer yet?
|
|
|
|
|
I found a solution:
Looking at the structure of the SHELLDLL_DefView on Windows 2000 you can see that in THUMBNAIL_VIEW_MODE there is an additional window created with the class "ThumbnailVwExtWnd32". This is the reason why the standard way to specify the FOLDERSETTINGS for THUMBNAILS does not work.
BUT: You can force the SHELLDLL_DefView-Window to create thumbnails by sending a WM_COMMAND message with the <wparam=28721>. This is also down by the framing explorer window if the IShellView is hosted by the standard explorer.
To get correct information about the actual view state when browsing to a new folder you can query for the child window <thumbnailvwextwnd32> with the function <findwindowex>. If this window exists then the actual view is THUMBNAIL.
This all works fine for Windows2000!
info@intek-darmstadt.de
|
|
|
|
|
Try this code:
LRESULT CMainFrame::OnTreeItemSelected(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
{
...
else
{
fs.fFlags = FWF_NOWEBVIEW | FWF_NOSUBFOLDERS | FWF_BESTFITWINDOW |FWF_CHECKSELECT;//FVM_DETAILS;
fs.ViewMode = FVM_THUMBNAIL;
}
...
}
|
|
|
|
|
I wonder if "wonder" was the intended word, there?
|
|
|
|
|
Hello Sir,
On Clicking any folder present in the List View , opens up a New Window to display the sub folders.
What Modification is needed to make the sub folders displayed in the List View itself (instead of opening a new Window) like in Windows Explorer.
Thanks
Sincerely
Maria
Maria Jothi (Software Engineer)
MAIL-ID:maria_jothi@hotmail.com
|
|
|
|
|
Look at this post:
http://www.codeproject.com/shell/explorer.asp?forumid=2239&select=37182#xx37182xx
and also this:
http://codeguru.earthweb.com/mfc/comments/23793.shtml
http://codeguru.earthweb.com/mfc/comments/23193.shtml
|
|
|
|
|
Hello Sir,
On Clicking any folder in the List View,it opens up a new Window to display its Folders and Files.
What modification is needed to make display of subfolders in the ListView itself (instead of opening a new Window) Like Windows Explorer??
Thanks.
Sincerely
Maria
Maria Jothi (Software Engineer)
MAIL-ID:maria_jothi@hotmail.com
|
|
|
|
|
|
Hi,
It comes with Microsoft Platform SDK Samples.
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
Thanx
|
|
|
|
|
This sample documents the DDE stuff, explaining what it all means, and how to use it...
http://support.microsoft.com/support/kb/articles/q189/6/34.asp
|
|
|
|