2009-11-21 2 views

답변

3
CComPtr<IHTMLSelectionObject> pSelection; 
    hr = pHTMLDocument->get_selection(&pSelection); 
    if (FAILED(hr) || pSelection==NULL) 
      return false; 

    CComPtr<IDispatch> pDispRange; 
    hr = pSelection->createRange(&pDispRange); 
    if (FAILED(hr) || pDispRange==NULL) 
      return false; 
    CComPtr<IHTMLTxtRange> pRange; 
    hr = pDispRange->QueryInterface(IID_IHTMLTxtRange, 
      reinterpret_cast<void**>(&pRange)); 
    if (FAILED(hr)|| pRange ==NULL) 
      return false;