Getting selected files from windows explorer

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Shafiq

    #1

    Getting selected files from windows explorer

    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 ManageConnectio n(ConnectType eConnectType)
    {
    if (Explorer == null)
    return;

    // Explorer is nothing but an instance of WebBrowserClass
    UCOMIConnection PointContainer cpc = Explorer as
    UCOMIConnection PointContainer ;
    if(cpc != null)
    {
    UCOMIConnection Point spConnectionPoi nt;
    Guid guid = typeof(SHDocVw. DWebBrowserEven ts2).GUID;
    cpc.FindConnect ionPoint(ref guid, out spConnectionPoi nt);
    if (spConnectionPo int == null)
    throw new ArgumentExcepti on("COM object does not
    support specified source interface");

    if (eConnectType == ConnectType.Adv ise)
    {
    spConnectionPoi nt.Advise(this, out iCookie);
    }
    else
    {
    spConnectionPoi nt.Unadvise(iCo okie);
    }
    }
    else
    {
    throw new ArgumentExcepti on("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.
Working...