//+---------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (C) Microsoft Corporation, 1998.
//
//  File:       I C O M T A R G F . C P P
//
//  Contents:   ICommandTarget implementation for IConnectionFolder
//
//  Notes:
//
//  Author:     jeffspr   12 Mar 1998
//
//----------------------------------------------------------------------------

#include "pch.h"
#pragma hdrstop

#include "foldinc.h"    // Standard shell\tray includes



const IID CGID_ConnectionsFolder =
{0xeaf70ce4,0xb521,0x11d1,{0xb5,0x50,0x00,0xc0,0x4f,0xd9,0x18,0xd0}};


//+---------------------------------------------------------------------------
//
//  Member:     CConnectionFolder::QueryStatus
//
//  Purpose:    [IOleCommandTarget] Queries the object for the status of one 
//              or more commands generated by user interface events.
//
//              This interface is required but is currently unimplemented
//
//  Arguments:  
//      pguidCmdGroup [in]      // Pointer to command group
//      cCmds         [in]      // Number of commands in prgCmds array
//      prgCmds       [in,out]  // Array of commands
//      pCmdText      [in,out]  // Pointer to name or status of command
//
//  Returns:    
//
//  Author:     jeffspr   12 Aug 1999
//
//  Notes:      
//
HRESULT CConnectionFolder::QueryStatus(
    const GUID *    pguidCmdGroup,
    ULONG           cCmds,
    OLECMD          prgCmds[],
    OLECMDTEXT *    pCmdText)
{
    TraceFileFunc(ttidShellFolderIface);

    HRESULT hr  = E_NOTIMPL;

    TraceHr(ttidError, FAL, hr, (hr == E_NOTIMPL), "CConnectionFolder::QueryStatus");
    return hr;
}

//+---------------------------------------------------------------------------
//
//  Member:     CConnectionFolder::Exec
//
//  Purpose:    [IOleCommandTarget] Executes a specified command or displays 
//              help for a command.
//  
//              This method is not currently referenced, but if the shell
//              wanted to enumerate only incoming our outgoing connections,
//              it would use the CFCID_SETENUMTYPE command to force the 
//              issue (that is unimplemented on our side, however)
//
//  Arguments:  
//      pguidCmdGroup [in]      // Pointer to command group
//      nCmdID        [in]      // Identifier of command to execute
//      nCmdexecopt   [in]      // Options for executing the command
//      pvaIn         [in]      // Pointer to input arguments
//      pvaOut        [in,out]  // Pointer to command output
//
//  Returns:    
//
//  Author:     jeffspr   12 Aug 1999
//
//  Notes:      
//
HRESULT CConnectionFolder::Exec(
    const GUID *    pguidCmdGroup,
    DWORD           nCmdID,
    DWORD           nCmdexecopt,
    VARIANTARG *    pvaIn,
    VARIANTARG *    pvaOut)
{
    TraceFileFunc(ttidShellFolderIface);

    HRESULT hr  = NOERROR;

    if (!pguidCmdGroup)
    {
        return hr;
    }
    
    // Handle Shell pre-enumeration commands here.
    //
    if (IsEqualGUID(*pguidCmdGroup, CGID_ConnectionsFolder))
    {
        switch (nCmdID)
        {
            case CFCID_SETENUMTYPE:
                m_dwEnumerationType = nCmdexecopt;
                break;
            default:
                hr = S_OK;
                break;
        }
    }

    TraceHr(ttidError, FAL, hr, FALSE, "CConnectionFolder::Exec");
    return hr;
}

