Enumerazione ContextLinkDirection

Specifica la direzione di un oggetto IContextLink .

Sintassi

typedef enum ContextLinkDirection { 
  ContextLinkDirection_LinksWith  = 0,
  ContextLinkDirection_LinksFrom  = 1,
  ContextLinkDirection_LinksTo    = 2
} ContextLinkDirection;

Costanti

ContextLinkDirection_LinksWith

IContextNode è un disegno direzionale che punta lontano da IContextLink.

ContextLinkDirection_LinksFrom

IContextNode è un disegno direzionale che punta a IContextLink.

ContextLinkDirection_LinksTo

Nessun disegno direzionale nel collegamento. Ad esempio, un disegno input penna può sottolineare una parola input penna. Non esiste alcuna direzione dedotta dalla sottolineatura.

Esempio

L'esempio seguente accetta un oggetto IContextNode , m_pSelectedNodee salva tutti gli oggetti IContextNode a cui si collega passando verso l'alto l'albero predecessore e aggiungendo gli oggetti in un CArray oggetto , linkedToNodes. CheckHResult è una funzione che accetta e HRESULT una stringa e genera un'eccezione creata con la stringa se non HRESULT è SUCCESS.

// Find all first ancestor that contains links of type Enclose
CArray<IContextNode*,IContextNode*> linkedToNodes = CArray<IContextNode*,IContextNode*>();
IContextNode* pAncestor;
CheckHResult(m_pSelectedNode->GetParentNode(&pAncestor),
    "IContextNode::GetParentNode failed");
while (pAncestor != NULL)
{
    // Get the links
    IContextLinks* pLinks;
    CheckHResult(pAncestor->GetContextLinks(&pLinks),
        "IContextNode::GetContextLinks failed");
    ULONG nLinks;
    CheckHResult(pLinks->GetCount(&nLinks), "IContextLinks::GetCount failed");
    for (ULONG i = 0; i < nLinks; i++)
    {
        IContextLink* pLink;
        CheckHResult(pLinks->GetContextLink(i, &pLink),
            "IContextLinks::GetContextLink failed");
        // Check link direction
        ContextLinkDirection linkDirection;
        CheckHResult(pLink->GetContextLinkDirection(&linkDirection),
            "IContextLink:GetContextLinkDirection failed");
        if (linkDirection == ContextLinkDirection_LinksTo)
        {
            // Get source node and add the array
            IContextNode* pSourceNode;
            CheckHResult(pLink->GetSourceNode(&pSourceNode),
                "IContextLink::GetSourceNode failed");
            linkedToNodes.Add(pSourceNode);
        }
    }
            
    // Go up another level
    IContextNode* pNewAncestor;
    CheckHResult(pAncestor->GetParentNode(&pNewAncestor),
        "IContextNode::GetParentNode failed");
    pAncestor = pNewAncestor;
}

Requisiti

Requisito Valore
Client minimo supportato
Windows XP Tablet PC Edition [solo app desktop]
Server minimo supportato
Nessuno supportato
Intestazione
IACom.h (richiede anche IACom_i.c)

Vedi anche

IContextLink

IContextNode::AddContextLink