Lm th? no ? k?t n?i v?i m?t tr?ng h?p ho?t ?ng c?a Internet Explorer

D?ch tiu ? D?ch tiu ?
ID c?a bi: 176792 - Xem s?n ph?m m bi ny p d?ng vo.
Bung t?t c? | Thu g?n t?t c?

Tm t?t

N c th? k?t n?i v?i m?t tr?ng h?p ho?t ?ng c?a Internet Explorer phin b?n 4.0 ho?c sau b?ng cch s? d?ng b? su t?p SHDocVw.ShellWindows.

Thng tin thm

Thng th?ng, m?t ?ng d?ng k?t n?i v?i m?t tr?ng h?p ho?t ?ng c?a m?t ?ng d?ng b?ng cch s? d?ng b?ng ?i t?ng ch?y. B?i v? Internet Explorer 4,0 khng ki?m nh?p chnh n trong b?ng ?i t?ng ang ch?y, phng php khc l c?n thi?t.

Cc b? su t?p ShellWindows ?c m t? trong Internet Khch hng SDK nh sau: Cc ShellWindows ?i t?ng ?i di?n cho m?t b? su t?p c?a cc m? c?a s? thu?c v? v?. Trong th?c t?, c ch?a b? su t?p ny ti li?u tham kh?o cho Internet Explorer c?a s? c?ng nh khc thu?c cc v?, ch?ng h?n nh Window Explorer.

Visual Basic m? sau c ?c m?t tham chi?u ?n b? su t?p ShellWindows. Cc b? su t?p li?t k v LocationName cho m?i ?i t?ng vo m?t h?p danh sch. N?u cc ti li?u lin k?t v?i cc ?i t?ng l lo?i HTMLDocument (trang Web), cc tiu ? cho web site ?c thm vo m?t h?p danh sch.

? ch?y cc sau khi m?, n l c?n thi?t ? thm m?t tham chi?u ?n "Internet c?a Microsoft i?u khi?n"(Shdocvw.dll) v"Microsoft HTML ?i t?ng th vi?n"(Mshtml.dll) ? cc Visual Basic d? n:
Dim SWs As New SHDocVw.ShellWindows
Dim IE As SHDocVw.InternetExplorer

Private Sub Form_Load()
   Dim Doc
   List1.Clear
   List2.Clear

   Text1.Text = SWs.count

   For Each IE In SWs
      List1.AddItem IE.LocationName

      Set Doc = IE.Document
      If TypeOf Doc Is HTMLDocument Then
         'if this is an HTML page, display the title
         'may or may not be the same as LocationName
         List2.AddItem Doc.Title
      End If
   Next
End Sub
				

Trong c + +, m?t k?t n?i c th? ?c th?c hi?n trong kho?ng theo cng m?t cch. Visual C++ b?n Com h? tr? ?c s? d?ng ? y v? l?i ch c?a ng?n g?n.

Thm ti li?u tham kh?o ? Shdocvw.dll v Mshtml.dll vo d? n:
#import <mshtml.dll> // Internet Explorer 4.0x
#import <mshtml.tlb> // Internet Explorer 5
#import <shdocvw.dll>
				
Tuyn b? m?t th? hi?n c?a m?t con tr? IShellWindows trong l?p h?c xem c?a b?n:
SHDocVw::IShellWindowsPtr m_spSHWinds;
				
T?o ra m?t th? hi?n c?a m?t ?i t?ng ShellWindows trong nh xy d?ng c?a xem c?a b?n:
m_spSHWinds.CreateInstance(__uuidof(SHDocVw::ShellWindows));
				
S? d?ng cc ?i t?ng ShellWindows trong xem c?a b?n OnInitialUpdate ch?c nng:
void CConnectIEView::OnInitialUpdate()
{
   CFormView::OnInitialUpdate();

   ASSERT(m_spSHWinds != NULL);

   CString strCount;
   long nCount = m_spSHWinds->GetCount();

   strCount.Format("%i", nCount);
   m_strWinCount = strCount;

   UpdateData(FALSE);

   IDispatchPtr spDisp;
   for (long i = 0; i < nCount; i++)
   {
      _variant_t va(i, VT_I4);
      spDisp = m_spSHWinds->Item(va);

      SHDocVw::IWebBrowser2Ptr spBrowser(spDisp);
      if (spBrowser != NULL)
      {
         m_ctlListLoc.AddString(spBrowser->GetLocationName());

         MSHTML::IHTMLDocument2Ptr spDoc(spBrowser->GetDocument());
         if (spDoc != NULL)
         {
             m_ctlListTitle.AddString(spDoc->Gettitle());
         }
      }
   }
}
				

Cc phng php tr?c ? k?t n?i v?i m?t tr?ng h?p ho?t ?ng c?a cc Internet Explorer khng ho?t ?ng n?u Shell h?i nh?p cha ?c ci ?t chuyn bi?t, ho?c n?u "Tr?nh duy?t trong m?t quy tr?nh m?i" ?c ch?n trong Internet Explorer 4.0.

N?u nh?ng y?u t? ny khng th? ?c ki?m sot, v?n c?n c m?t phng php c th? c th? lm vi?c. M?t ?i t?ng tr? gip tr?nh duy?t c th? ?c ghi vo ki?m nh?p Internet Explorer 4.0 trong i tng hin hoat b?ng (ROT). C nhi?u tri?n khai c th? ? y ty thu?c vo cch ?ng d?ng l ? xc ?nh cc tr?ng h?p c?a Internet Thm hi?m m ? k?t n?i. y l ch? l m?t gi?i php c th?: tr?nh duy?t ?i t?ng tr? gip, c quy?n truy c?p vo cc m h?nh ?i t?ng trong tr?ng h?p c?a Explorer m a ra n, s? xc ?nh n?u y l tr?ng h?p c?a tr?nh duy?t m ph?i ?c ki?m nh?p trong b?ng ?i t?ng ang ch?y.

Giao di?n m ng?i tiu dng l quan tm ?n vi?c c th? ?c ki?m nh?p t?i ROT v?i cc RegisterActiveObject ch?c nng v m?t CLSID gi? ng?i tiu dng s? nh?n ra. M?t gi?i php, m s? cho php nhi?u tr?ng h?p c?a cc Explorer ? ?c ki?m nh?p t?i ROT, s? l ? c tr? gip tr?nh duy?t ?i t?ng so?n m?t bi?t danh m?c d?a trn m?t GUID v ph?n d? li?u duy nh?t cho m?i tr?ng h?p c?a Internet Explorer. Bi?t danh s? ?c ki?m nh?p t?i ROT v?i phng php IRunningObjectTable::Register. M?t l?n n?a, ng?i tiu dng c th? bi?t lm th? no nh?n ra bi?t danh ny.

Tham kh?o

? bi?t thm chi ti?t, xin vui l?ng truy c?p vo web site MSDN tr?c tuy?n H?i th?o t?i:
Th vi?n MSDN
Khch hng Internet SDK; tra c?u trn Internet cng c? v Cng ngh? - Windows Shell API

? bi?t thm chi ti?t, xin vui l?ng Xem bi vi?t sau trong c s? ki?n th?c Microsoft:
179230 T?p tin: IEHelper-g?n v?i IE4 b?ng cch s? d?ng m?t ?i t?ng tr? gip tr?nh duy?t
? bi?t thm chi ti?t, xin vui l?ng truy c?p bi vi?t sau y t?i:
http://msdn2.Microsoft.com/en-US/Library/Bb250436.aspx
(c) Microsoft Corporation 1997, t?t c? cc quy?n. Nh?ng ng gp c?a Robert cng t?c, Microsoft Corporation

Thu?c tnh

ID c?a bi: 176792 - L?n xem xt sau cng: 20 Thang Bay 2013 - Xem xt l?i: 3.0
p d?ng
  • Microsoft Internet Client Software Development Kit 4.01
T? kha:
kbcode kbhowto kbmt KB176792 KbMtvi
My d?ch
QUAN TRONG: Bai vit nay c d?ch b?ng phn mm dich thu?t cua Microsoft va co th c Cng ng Microsoft chinh sa l?i thng qua cng ngh CTF thay vi mt bin dich vin chuyn nghip. Microsoft cung c?p cc bi vi?t ?c c? bin d?ch vin v ph?n m?m d?ch thu?t th?c hi?n v c?ng ?ng ch?nh s?a l?i ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng nhi?u ngn ng? Tuy nhin, bi vi?t do my d?ch hoc thm chi cng ng chinh sa sau khng ph?i lc no c?ng hon h?o. Cc bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny: 176792

Cung cp Phan hi

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com