Lm th? no ? c ?c IHTMLDocument2 t? m?t HWND

D?ch tiu ? D?ch tiu ?
ID c?a bi: 249232 - 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

Bi vi?t ny cho th?y lm th? no ? c ?c giao di?n IHTMLDocument2 t? m?t HWND. N?u Microsoft ho?t ?ng kh? nng ti?p c?n (MSAA) ?c ci ?t chuyn bi?t, b?n c th? g?i WM_HTML_GETOBJECT c?a ti li?u c?a s? (v?i l?p window "Internet Explorer_Server") v sau v?t qua k?t qu? t? SendMessage ?n m?t ch?c nng MSAA, ObjectFromLresult, ? c ?c m?t con tr? IHTMLDocument2 ?y ? marshaled.

Thng tin thm

B?n ph?i c kh? nng ti?p c?n ho?t ?ng cc thnh ph?n ci ?t chuyn bi?t trn h? th?ng cho cc m? ?c m t? trong ph?n ny ? lm vi?c. Nh pht tri?n khch hng c th? s? d?ng SDK ? pht tri?n v C?p Nh?t kh? nng ti?p c?n ho?t ?ng aids. N?u b?n k?t h?p phin b?n m?i nh?t c?a kh? nng ti?p c?n ho?t ?ng v phn ph?i cc phin b?n m?i c?a aids kh? nng ti?p c?n c?a b?n, b?n ph?i phn ph?i linh ki?n th?i gian ch?y (RDK) cho cc khch hng ? ?c pht tri?n cho Microsoft Windows 95, Windows 98, ho?c Windows NT 4.0 v?i Service Pack 4 ho?c 5. N khng ph?i l c?n thi?t ? bao g?m RDK cho khch hng pht tri?n ch? duy nh?t cho Windows 2000 ho?c Windows NT 4.0 v?i b?n ghi d?ch v? gi 6. Cc thnh ph?n m?i ? ?c bao g?m trong cc h iu hanh.

H?y xem ph?n "Tham kh?o" c?a bi vi?t ny cho cc thng tin v? kh? nng ti?p c?n ho?t ?ng v ni ? t?i v? kh? nng ti?p c?n SDK ho?t ?ng.
#include <mshtml.h>
#include <atlbase.h>
#include <oleacc.h>

BOOL CALLBACK EnumChildProc(HWND hwnd,LPARAM lParam)
{
	TCHAR	buf[100];

	::GetClassName( hwnd, (LPTSTR)&buf, 100 );
	if ( _tcscmp( buf, _T("Internet Explorer_Server") ) == 0 )
	{
		*(HWND*)lParam = hwnd;
		return FALSE;
	}
	else
		return TRUE;
};

//You can store the interface pointer in a member variable 
//for easier access
void CDlg::OnGetDocInterface(HWND hWnd) 
{
	CoInitialize( NULL );

	// Explicitly load MSAA so we know if it's installed
	HINSTANCE hInst = ::LoadLibrary( _T("OLEACC.DLL") );
	if ( hInst != NULL )
	{
		if ( hWnd != NULL )
		{
			HWND hWndChild=NULL;
			// Get 1st document window
			::EnumChildWindows( hWnd, EnumChildProc, (LPARAM)&hWndChild );
			if ( hWndChild )
			{
				CComPtr<IHTMLDocument2> spDoc;
				LRESULT lRes;
			
				UINT nMsg = ::RegisterWindowMessage( _T("WM_HTML_GETOBJECT") );
				::SendMessageTimeout( hWndChild, nMsg, 0L, 0L, SMTO_ABORTIFHUNG, 1000, (DWORD*)&lRes );

				LPFNOBJECTFROMLRESULT pfObjectFromLresult = (LPFNOBJECTFROMLRESULT)::GetProcAddress( hInst, _T("ObjectFromLresult") );
				if ( pfObjectFromLresult != NULL )
				{
					HRESULT hr;
					hr = (*pfObjectFromLresult)( lRes, IID_IHTMLDocument, 0, (void**)&spDoc );
					if ( SUCCEEDED(hr) )
					{
						// Change background color to red
						spDoc->put_bgColor( CComVariant("red") );
					}
				}
			} // else document not ready
		} // else Internet Explorer is not running
		::FreeLibrary( hInst );
	} // else Active Accessibility is not installed
	CoUninitialize();
}
				
Lu ?: Tr?c khi Internet Explorer 5.5, khung ? ?c th?c hi?n b?ng cch lu tr? m?t tr?ng h?p m?i c?a Shdocvw.dll, v m?i khung c m?t c?a s? ring bi?t, lin k?t v?i n. Internet Explorer 5.5 th?c hi?n b?n x? khung cho hi?u su?t t?t hn, v t?t c? cc khung ?c th?c hi?n b?i tr?ng h?p tng t? c?a Shdocvw.dll. K? t? khi s? khng c HWND m?t cho m?i khung h?nh cho Internet Explorer 5.5 v sau , cc m?u m? ?c m t? trong ph?n ny s? lm vi?c ? c ?c ti li?u trong ca s chinh ch?. B?n v?n c th? nh?n ?c ti li?u m?i khung b?ng cch s? d?ng b? su t?p khung h?nh c?a cc tai liu chnh.

Tham kh?o

SDK cho nh pht tri?n v RDK, ci ?t chuyn bi?t cc thnh ph?n th?i gian ch?y ho?t ?ng truy c?p vo h iu hanh, c th? ?c t?i v? t? cc Microsoft Web site sau:
http://www.Microsoft.com/downloads/details.aspx?FamilyID=9b14f6e1-888a-4f1d-b1a1-da08ee4077df&DisplayLang=en
? bi?t thng tin v? h? tr? kh? nng ti?p c?n ho?t ?ng Microsoft cung c?p b?i cc thnh ph?n MSHTML c?a Microsoft Internet Explorer, h?y gh thm Web site sau:
V? kh? nng ti?p c?n ho?t ?ng h? tr?
? bi?t thm chi ti?t, nh?p vo s? bi vi?t sau ? xem bi vi?t trong c s? ki?n th?c Microsoft:
176792Lm th? no ? k?t n?i v?i m?t tr?ng h?p ho?t ?ng c?a Internet Explorer

Thu?c tnh

ID c?a bi: 249232 - L?n xem xt sau cng: 30 Thang Nm 2013 - Xem xt l?i: 3.0
p d?ng
  • Microsoft Internet Explorer 4.01 Service Pack 1
T? kha:
kbhowto kbmshtml kbwebbrowser kbmt KB249232 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: 249232
Khc t Ni dung trong C s Kin thc Khng con c h tr
Bi vi?t ny ni v? cc s?n ph?m m Microsoft khng c?n h? tr? n?a. Do , bi vi?t ny ?c cung c?p "nguyn b?n" v s? khng ?c c?p nh?t.

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