Platform SDK Shell >> Browsing problems

by mari.c » Tue, 29 Mar 2005 23:29:07 GMT

Hi all

I am feeling kind of stupid asking the following question, but I'm
definitely not seeing it. Maybe I am developing some king of
programming blindness or simply I am becoming brainless.

What I would like to know is the best way to control repeated browsing
errors. The situation is the following: I am using another module that
provides connectivity to the device I am trying to browse. It has a
"connect" function that I call to access that device and upon errors
in that "connection" I display a message box with the error reason. My
NSE follows the MS's CDBView / SampView samples and calls EnumObjects
from the CShellView::FillList to enumerate the view's contents.
What I am not seeing is how can I easily avoid the recursively errors
from being displayed. Ideally what I would like is if the first
EnumObjects fails no other(s) is(are) tried having also the Refresh
scenario in mind. I tried some flags dependent solutions and have
always failed under some circumstance.
I know this could have easily been avoided with a lower layer
controlling the device's objects/accesses but I didn't start the
project that way and is a little late for that now.

Also, can I assume that the view browsing always take place first than
the tree browsing?

I am currently running Win XP Pro/Sp2, VS 6 SP6 with 2003 February's
SDK.

Please give me some help even if you think this is a basic (beginner
and maybe stupid) question and I think it must be, but I am really
blind with it.

Thanks,
Mari


Platform SDK Shell >> Browsing problems

by Jim Barry » Wed, 06 Apr 2005 05:37:59 GMT





This is a little tricky, but I don't think it is too bad as long as you don't display the error message when the hwndOwner parameter is null. The error message should then only pop up once each time you browse to the namespace. If you choose "Open" or "Explore" from the context menu of the NSE root, the owner window will be the still-hidden Explorer window created to host the new view.

One possibility is to fail the CreateViewWindow method (though the SampView code needs a bit of rearranging to make this work properly). Then, if the NSE is selected in the tree, the shell jumps back to the previously selected folder after the error message is dismissed.

--
Jim Barry, MVP for Windows SDK



Platform SDK Shell >> Browsing problems

by mari.c » Wed, 06 Apr 2005 19:25:04 GMT

I Jim, thanks for your reply.


But if I make a "blind" mode (no msgs) depending on hwndOwner=NULL, I
will not be able to display connecting errors when I browse in the
tree using the [+] sign, and I must warn the user of every error: it's
a tool requisite.
Please note also that I cannot stay connected to the device. II have
to (try to) connect every time I have to access it and disconnect
after.


I already tried that since it would be an easy and logical solution
but it crashed explorer when my NSE was called from the desktop.

Once again, many thank Jim.
If you stay with me on this one I would be much appreciated,
Mari


Browsing problems

by Jim Barry » Wed, 06 Apr 2005 19:45:38 GMT




I don't see how this will be possible. It is actually a documented requirement that EnumObjects should not pop up any messages if hwndOwner is null.


I noticed that too, when I tried it in SampView, but the cause is not immediately apparent. However, it works fine in my own NSE (not based on SampView).

--
Jim Barry, MVP for Windows SDK


Browsing problems

by TWFyaQ » Wed, 06 Apr 2005 21:51:04 GMT






Although I have read that in the documentation I don understand the logic
of this scenario (maybe MS has some weird logic or I just miss the point!):
Using a SNE if I try to connect to some device to browse it (using the [+]
sign) and an error occurs, NSE cannot give the error reason.
But that me
At least at the first browsing attempt (first connect) using the [+] I
should be able to warn the user in case of error. In my case I need this in
every level in the folders hierarchy.
>> >>>> I already tried that since it would be an easy and logical solution >>>> but it crashed explorer when my NSE was called from the desktop. >> >> I noticed that too, when I tried it in SampView, but the cause is not immediately apparent. However, it works fine in my own NSE (not based on SampView). >>
Did you figured what the problem was? That would solve my (this) problem.

Thanks again.
Mari



Browsing problems

by mari.c » Thu, 07 Apr 2005 01:28:27 GMT

Also, it seems to that even SampView (latest SDK SNE sample) has too
many bugs. Is there any more reliable sample available out there you
can point me to?

Mari.


Browsing problems

by Jim Barry » Thu, 07 Apr 2005 19:34:43 GMT




Well, the tree should remove the [+] button to indicate that no subfolders are available. If the user tries to browse into the extension, the error message will be shown then. That doesn't seem too bad to me.

--
Jim Barry, MVP for Windows SDK


Browsing problems

by Jim Barry » Thu, 07 Apr 2005 19:51:53 GMT




Decent NSE samples are hard to come by, though I'm sure you will find something if you look around... how about http://www.viksoe.dk/code/adfview.htm. I have a few things cooking myself , but they're still not quite ready.

--
Jim Barry, MVP for Windows SDK


Browsing problems

by TWFyaQ » Fri, 08 Apr 2005 02:57:06 GMT

> Well, the tree should remove the [+] button to indicate that no subfolders
are available. If the user tries to browse into the extension, the error
message will be shown then. That doesn't seem too bad to me.

Are you talking about the NSE folder only or every one?
For the NSE folder (if I remove the SFGAO_HASSUBFOLDER attribute I set in
the RegisterServer()), I loose the expandability of NSE folder isn it? Also
the [+] (and thus the tree xpandoption) for the NSE tree folder will only
appear if I enter the second level folder (using the view), right?

About the AdfView, I saw that sample but since I knew nothing about ATL it
would take a considerable amount of time to understand it, delay that I
cannot afford now. CDBView / SampView and also RegView and Dinno Esposito
WinView seemed a good starting point when I first look at SNEs. I now realize
that I followed the wrong approach and learning ATL at first place would have
been a winning bet.

Once again, many thanks Jim. I really appreciate your support.


Browsing problems

by Jim Barry » Mon, 11 Apr 2005 21:08:03 GMT




I was talking about the root, but it should apply just as well to subfolders.


I meant that the [+] button will be removed if EnumObjects fails.


Yes, but your view might also be able to get the [+] button to come back by calling SHChangeNotify. Maybe you can give it a try and let us know whether it works.
>> About the AdfView, I saw that sample but since I knew nothing about >> ATL it would take a considerable amount of time to understand it, >> delay that I cannot afford now. CDBView / SampView and also RegView >> and Dinno Esposito WinView seemed a good starting point when I >> first look at SNEs. I now realize that I followed the wrong approach >> and learning ATL at first place would have been a winning bet.

Yes, I heartily recommend ATL for writing shell extensions :-)

--
Jim Barry, MVP for Windows SDK