By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,454 Members | 1,803 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,454 IT Pros & Developers. It's quick & easy.

Getting selected files from windows explorer

P: n/a
Hi All,

Based on the sample kbbar.net applicaation i have created a tool bar
for windows explorer. Now i have to enable and disable few buttons
based the user slects file in the explorer. For to sync this i have
set-up the connection point as in the following function. I could
able
to get the events only when the user double cliks a folder in the
explorer treview or list view. If the user slect an item by single
click no notification is recieved from Explorer. Please help me in
this regard.

private void ManageConnection(ConnectType eConnectType)
{
if (Explorer == null)
return;

// Explorer is nothing but an instance of WebBrowserClass
UCOMIConnectionPointContainer cpc = Explorer as
UCOMIConnectionPointContainer ;
if(cpc != null)
{
UCOMIConnectionPoint spConnectionPoint;
Guid guid = typeof(SHDocVw.DWebBrowserEvents2).GUID;
cpc.FindConnectionPoint(ref guid, out spConnectionPoint);
if (spConnectionPoint == null)
throw new ArgumentException("COM object does not
support specified source interface");

if (eConnectType == ConnectType.Advise)
{
spConnectionPoint.Advise(this, out iCookie);
}
else
{
spConnectionPoint.Unadvise(iCookie);
}
}
else
{
throw new ArgumentException("COM object does not support
events");
}

}

Alos I have few questions.

1. The connection point works both in the IE and Windows Explorer.
How
can i restrict to only Windows explorer.
2. Whether webbrowser class is equivalent to Windows explorer? or
there is any other class for windows explorer.

Thanks for your patientce and help.

Tx,
Shafeeque O.K.
Dec 25 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.