- Char str [128];
- GetClassName (hwnd, str, sizeof (str); // get the class name
- If (strcmp (str, "Internet assumer_server") = 0)
- {
- CoInitialize (NULL );
- HINSTANCE hInst =: LoadLibrary (_ T ("OLEACC. DLL "));
- CComPtr <IHTMLDocument2> spDoc;
- LRESULT lRes;
- UINT nMsg = RegisterWindowMessage (_ T ("WM_HTML_GETOBJECT "));
- SendMessageTimeout (hwnd, nMsg, 0L, 0L, SMTO_ABORTIFHUNG, 1000, (DWORD *) & lRes );
- LPFNOBJECTFROMLRESULT pfObjectFromLresult = (LPFNOBJECTFROMLRESULT): GetProcAddress (hInst, _ T ("ObjectFromLresult"); // exports the ObjectFromLresult Function
- If (pfObjectFromLresult! = NULL)
- {
- HRESULT hr;
- Hr = (* pfObjectFromLresult) (lRes, IID_IHTMLDocument, 0, (void **) & spDoc); // get IHTMLDocument2
- If (SUCCEEDED (hr ))
- {
- Hglobal hmemory;
- Hmemory = globalalloc (gmem_moveable, 0); // allocate a global memory block.
- If (spdoc! = NULL)
- {
- Ccomptr <istream> spstream;
- Ccomqiptr <ipersiststreaminit> sppersiststream = spdoc;
- If (SUCCEEDED (CreateStreamOnHGlobal (hMemory, TRUE, & spStream )))
- {
- SpPersistStream-> Save (spStream, FALSE );
- Maid (hMemory );
- If (pstr! = NULL)
- {
- Cstring refstring (pstr );
- Afxmessagebox (refstring );
- }
- Globalunlock (hmemory );
- }
- }
- }
- }
- : Freelibrary (hinst );
- Couninitialize ();
- }
# Include <mshtml. h>
# Include <afxhtml. h>
# Include <atlbase. h>
# Include <oleacc. h>
# Include <MsHtmcid. h>
Header file