我的征途2提示Can'tunable to load dllOLEACC.dll是什么意思?

1473人阅读
求救!!! 取ie浏览器文字乱码问题,高分相赠!!!&
我所写的一个程序中有这样一个功能:用户选取了ie浏览器中的一段文字copy到剪贴板,我的程序从剪贴板中取出文字并显示在edit框中,这在中文系统下没有任何问题,而当程序运行在英文日文98下时,ie中的中文字符从剪贴板中取后在edit框中显示为乱码,edit框已设了MS Song体,能正确显示gb2312编码的汉字,估计ie中的中文为unicode什么的,我就想把它转为ascii码,但试了很多方法都不行.if(OpenClipboard()){&& if(IsClipboardFormatAvailable (CF_UNICODETEXT))& {&&& WCHAR *s;&&& CS&&& HANDLE handle=GetClipboardData(CF_UNICODETEXT);&&& s=(WCHAR*)&&& string=s;&&& string.TrimLeft();&&& string.TrimRight();&&& if(string!="")&& {&&&& char dest[256];&&&& len=string.GetLength();&&&& int len = WideCharToMultiByte(CP_ACP,0,s,len,dest,256,NULL,NULL);&&&& GetDlgItem(IDC_EDIT1)-&SetWindowText(dest);//显示乱码&& }&& EmptyClipboard();&& CloseClipboard();}到底ie中的中文字符是什么编码,怎样转成gb2312,请各位高人指点,一定高分相赠!!!
IMultiLanguage::ConvertStringFromUnicode Method--------------------------------------------------------------------------------Translates the source Unicode string to the specified multibyte code page. SyntaxHRESULT ConvertStringFromUnicode(&&& DWORD *pdwMode,&&& DWORD dwEncoding,&&& WCHAR *pSrcStr,&&& UINT *pcSrcSize,&&& CHAR *pDstStr,&&& UINT *pcDstSize);ParameterspdwMode[in, out] Storage for conversion context. A calling function should only provide storage that is initialized with zero at the first call to the method. The caller should not modify the value. dwEncoding[in] Code page identifier value for the destination multibyte string. This value is equivalent to the uiCodePage member of the MIMECPINFO structure assigned to dwEncoding. pSrcStr[in] Address of the Unicode string that is to be converted. pcSrcSize[in, out] Address of the buffer that stores the length of the source string, in character counts. If this is NULL, or if -1 is specified as the length, the API assumes pSrcStr is null-terminated. When conversion is successful, the method returns the number of characters processed to this buffer. pDstStr[in] Address of the string buffer where the conversion result will be stored. pcDstSize[in, out] Address of the buffer that stores the length of pDstStr, in byte counts. When conversion is successful, the method returns the number of bytes copied to pDstStr to this buffer. Return ValueReturns one of the following values:S_OK Success.& S_FALSE The specified conversion is not supported on the system.& E_FAIL An error occurred.& RemarksNote that the size of the Unicode string to be converted is specified with a character count, while the size of the multibyte string returned is given in bytes. See AlsoIMultiLanguage2::ConvertStringFromUnicodeEx, IMultiLanguage2::ConvertStringInIStream, IMultiLanguage2::ConvertStringToUnicodeEx--------------------------------------------------------------------------------/i18n/papers/mlang/Using IMultiLanguage2&To access the methods provided by IMultiLanguage2, a program must instantiate a MultiLanguage object and request the IMultiLanguage2 interface. This is can be done via the COM API CoCreateInstance. For example:&&& hr = CoCreateInstance(&&&&&&&&&&&&&&&&&&&&&&&&&& CLSID_CMultiLanguage, //Class identifier (CLSID) of the object&&&&&&&&&&&&&&&&&&&&&&&&&& NULL,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //Pointer to controlling IUnknown&&&&&&&&&&&&&&&&&&&&&&&&&& CLSCTX_INPROC_SERVER,&& //Context for running executable code&&&&&&&&&&&&&&&&&&&&&&&&&& IID_IMultiLanguage2 ,&&&&&&&&&&&&&&&&& //Reference to the identifier of the interface&&&&&&&&&&&&&&&&&&&&&&&&&& (void**) &pMultiLanguage2&&&&&&&&&&&&&& //Address of output variable that receives &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& // the interface pointer requested in riid&&&&&&&&&&&&&&&&&&&&&&&&&& );&This call will return the address of the IMultiLanguage2 interface in pMultiLanguage2.&Note that if you are using Microsoft Visual C++ (MSVC) to create an IMultiLanguage2 client you will need to install a recent version of the Microsoft Platform SDK (the April 2000 version is sufficient). The Mlang.h and UUID.LIB that are supplied with MSVC itself do not support IMultiLanguage2.&Once the program has retrieved the interface pointer, it can then make calls into the IMultiLanguage2 API methods. For example:&&&& pMultiLanguage2-&ConvertString(&&&&&&&&&&& pdwMode,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 1252,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 437,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& pSrcStr,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& pcSrcSize,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& pDstStr,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& pcDstSize&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& );&This call copies characters from the source buffer to the destination buffer while doing an encoding conversion from code page 1252 to code page 437.&One might wonder why Microsoft created this API when there&s a pair of perfectly good Win32 APIs that can be used to do the same thing: MultibyteToWideChar and WideCharToMultibyte. Not only can this pair of calls do what IMultiLanguage2::ConvertString can do, but also you can supply a number of additional options in the Win32 APIs to control the conversion more completely. In addition, the Win32 APIs return more useful error codes. &One reason might be the apparent inability of MultibyteToWideChar and WideCharToMultibyte to support popular Internet encodings like EUC‑KR and ISO&#‑JP on Windows NT 4 and Windows 95/98 even with the appropriate language pack installed. (There is no such limitation on Windows 2000.) Perhaps the Windows and IE development teams are finally in synch in this respect. However, at this writing, there are some useful options available via the MLang Converter object that are not available via the Win32 APIs (see below).
关于网址过滤&
似乎用BHO可以控制IE,但是对ATL,COM还没怎么接触,哪位用过BHO的给讲解一下吧。111222的那篇我看过了,还是感觉不知道怎么开始。。。。
BHO只对IE有效,除非你规定用户只能用IE或者你自己编写的浏览器,否则用户用其他浏览器可以绕过你的限制另外一种方法是写一个防火墙&&但是防火墙也是可以被绕过去的要想真正屏蔽一个站点,可以使用屏蔽某搜索引擎时使用的方法是从中国电信的出国网关那里做文章&&你的办法可能只对基于IE的浏览器有效,但是你怎么禁止用户使用Netscape?MSDNWeb Development (General) Technical Articles&& Browser Helper Objects: The Browser the Way You Want It在函数Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags,&DISPPARAMS* pDispParams, VARIANT* pvarResult,&&& EXCEPINFO*& pExcepInfo,& UINT* puArgErr)中捕获DISPID_BEFORENAVIGATE2事件,如果需要过滤网址的话,pDispParams取得第五个参数并判断(参见BEFORENAVIGATE2事件的文档)并适当设置第一个参数(参见BEFORENAVIGATE2事件的文档)注意看Browser Helper Objects: The Browser the Way You Want It的这一段By calling the IConnectionPoint's Advise() method, the BHO lets the browser know that it is interested in receiving notifications about events. Due to the COM event-handling mechanism, all this actually means that the BHO provides the browser with a pointer to its IDispatch interface. The browser will then call back the IDispatch's Invoke() method, passing the ID of the event as the first argument.HRESULT CViewSource::Invoke(DISPID dispidMember, REFIID riid, && LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, && VARIANT* pvarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr){& if (dispidMember == DISPID_DOCUMENTCOMPLETE) {&&&&& OnDocumentComplete();&&&&& m_bDocumentCompleted =& }& :}It's important to remember to disconnect from the browser when events are no longer needed. If you forget to do this, the BHO will remain locked even after you close the browser's window. (Among other things, this means you can't recompile or delete the object.) A good time to disconnect is when you receive the OnQuit event.
急,急!用Script解释组件实现的一个脚本解释程序,如何自行解释windows等IE内置对象???&
使用MS的VBScript,JScript解释器能够解释脚本了,但IE是如何做到,当用户调用windows.open方法就打开一个新的IE文档,我该怎么做,使得用户一调用open方法,我就自行解释打开自己程序的文档??? IE下的脚本并且可以使用一些内置的IE变量,IE是如何编程做到的???一句话,使用MS的脚本解释器,如何让脚本语言执行时能识别调用,父程序明白的函数与变量。
external.yourfuntion?Extending the Dynamic HTML Object ModelIt is possible for the hosting application to extend the Dynamic HTML Object Model so that scripts can refer to functionality implemented by the host. Such scripts refer to the host by specifying the external object that is available from the window object. For example, a reference to "window.external.speech" will call the host to resolve the name "speech." All standard script within the document will be executed normally.This extension mechanism is implemented in the host by providing an IDispatch interface for the object model extension that will have IDispatch::GetIDsOfNames and IDispatch::Invoke called on it to resolve any references to the external object. The IDispatch that the host provides is obtained by the WebBrowser Control or MSHTML component by calling the host's IDocHostUIHandler::GetExternal method.For an example of how to extend the Dynamic HTML Object Model, see the Driller Sample Source Page
请教:如何用VC得到当前IE正在浏览的网页的网址和title?
我想在IE右键快捷菜单中加入一项,选择时即可获得当前网页的网址和title,我该如何做?
Knowledge Base Articles&& HOWTO: Connect to a Running Instance of Internet ExplorerQ176792
如何获得IE Frame 当中的scroll bar 的位置 masterz Jiangsheng help!!!!&
使用给位已经提供的方法可以获得IE Scroll bar 的位置但是如果是一个子frame 中,简单的使用IHTMLBody的方法,在有些IE版本 无法获得相对应的scroll bar 的位置 (总是0)请问如何获得frame 中的滚动条的位置
Frame.document.Body是否支持IHTMLTextContainer?
急!!!!!关于IE控件 500分相送!!!&
请问我已经得到IHTMLDocument2 如何把它显示到CWebBrowser2控件中呢?
query IPersistStream for HtmlDocument object,and then call IPersistStream::Load from a memory stream created by CreateStreamOnHGlobal.1 Create a WebBrowser host in Microsoft Visual C++ 6.0 or 7.0. For a sample implementation that uses the Active Template Library (ATL), see the following Microsoft Developer Network (MSDN) Web site: Web and Internet Samples: ATLBrowser/downloads/samples/internet/default.asp?url=/Downloads/samples/Internet/browser/atlbrowser/Default.asp2 Sink DWebBrowserEvents2 on the WebBrowser control. For more information about sinking WebBrowser events, see the following MSDN Web site: Reusing the WebBrowser Control: Working with WebBrowser Events/library/default.asp?url=/workshop/browser/webbrowser/webbrowser.asp3 When your application is created, call the IWebBrowser2 Navigate() method to move the WebBrowser to "about:blank". 4 Add code to your DWebBrowserEvents2::DocumentComplete() event handler to load a file from memory: &&& If (m_bInitial)& //m_bInitial is used to prevent the DocumentComplete event from being fired recursively, set it to TRUE after the Navigate() call.&&& {&&&&&&& HRESULT hr = E_FAIL;&&&&&&& CComPtr&IStream& spS&&&&&&& DWORD dwWritten = 0;&&&&&&& DWORD dwBytes = 0;&&&&&&& HANDLE handle = CreateFile("c://temp//test.htm", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);&&&&&&& if (handle != INVALID_HANDLE_VALUE) &&&&&&& {&&&&&&&&&&&&&&& TCHAR szBuffer[10240];&&&&&&&&&&&&&&& DWORD dwBytesR&&&&&&&&&&&&&&& if (ReadFile(handle, szBuffer, sizeof(szBuffer) - 1, &dwBytesRead, NULL))&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&& szBuffer[dwBytesRead] = '/0';&&&&&&&&&&&&&&&&&&& CloseHandle(handle); &&&&&&& &&&&&&&&&&&&&&&&&&& if (SUCCEEDED(CreateStreamOnHGlobal(NULL, TRUE, &spStream))) {&&&&&&&&&&&&&&&&&&&&&&& dwBytes = lstrlenA(szBuffer) + 1;&&&&&&&&&&&&&&&&&&&&&&& dwWritten = 0;&&&&&&&&&&&&&&&&&&&&&&& hr = spStream-&Write(szBuffer, dwBytes, &dwWritten);&&&&&&&&&&&&&&&&&&&&&&& LARGE_INTEGER li = {0, 0};&&&&&&&&&&&&&&&&&&&&&&& spStream-&Seek(li, STREAM_SEEK_SET, NULL);&&&&&&&&&&&&&&&&&&&&&&& CComPtr&IDispatch& spD&&&&&&&&&&&&&&&&&&&&&&& hr = m_pWebBrowser-&get_Document(&spDispatch);&&&&&&& &&&&&&&&&&&&&&&&&&&&&&& if (SUCCEEDED(hr)) {&&&&&&&&&&&&&&&&&&&&&&&&&&& CComQIPtr&IPersistStreamInit& spPersistStreamInit(spDispatch);&&&&&&&&&&&&&&&&&&&&&&&&&&& if (spPersistStreamInit != NULL) {&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& hr = spPersistStreamInit-&InitNew();&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& if (SUCCEEDED(hr)) {&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& hr = spPersistStreamInit-&Load(spStream);&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }&&&&&&&&&&&&&&&&&&&&&&&&&& }&&&&&&&&&&&&&&&&&&&&& }&&&&&&&&&&&&&&&& }&&&&&&&&&&&& }&&&&&&&& }& &&& }&&& m_bInitial = FALSE; #include "mshtml.h"//在SourceView中填写HtmlView中网页的源程序void CMainFrame::OnMethod2() {&&& IHTMLDocument2 *pHTMLDocument=NULL;&&& IPersistStreamInit *pPSI=NULL;&&& IStream *pStream=NULL; &&& HGLOBAL& hHTMLT &&& if& (!(pHTMLDocument = (IHTMLDocument2*)m_pHtmlView-&m_browser.GetDocument()))&&&&& if& (FAILED(pHTMLDocument-&QueryInterface(&pPSI)))&&& {//&& pHTMLDocument-&Release();&&&& } &&& hHTMLText = GlobalAlloc(GMEM_FIXED, MAX_SIZE);&&& CreateStreamOnHGlobal(hHTMLText, TRUE, &pStream); &&& pPSI-&Save(pStream, FALSE); //&& m_pSourceView-&SetWindowText((char*)hHTMLText);&&& long nEditLength = m_pSourceView-&GetEditCtrl().GetWindowTextLength();&&& m_pSourceView-&GetEditCtrl().SetSel(0, nEditLength);&&& m_pSourceView-&GetEditCtrl().ReplaceSel("");&&& char *pText = (char*)hHTMLT&&& long lHtmlLength = strlen(pText);&&& CString str("");&&& long n = 0;&&& for (long i=0; i & lHtmlL i++)&&& {&&&& if& (*pText != 0x0d && *pText != 0x0a)&&&& {&&&&& str += *pT&&&&& pText++;&&&& }&&&& else&&&& {&&&&& pText++;&&&&& if& (*pText == 0x0a)&& pText++;&&&&& str += "/r/n";&&&&& nEditLength = m_pSourceView-&GetEditCtrl().GetWindowTextLength();&&&&& m_pSourceView-&GetEditCtrl().SetSel(nEditLength, nEditLength);&&&&& m_pSourceView-&GetEditCtrl().ReplaceSel(str);&&&&& str.Empty();&&&& }&&& }&&& pStream-&Release();&&& pPSI-&Release();//&& pHTMLDocument-&Release();}三、修改HTML源代码以改变网页的显示 &&& 这部分比较有意思,可以当作是一个小的HTML编辑器,看看预演效果。特别的不是显示一个新文件,而是修改原来的HTML文件。关键代码: //根据SourceView里的HTML文本改变HtmlView里的显示void CMainFrame::OnChangehtml() {&IHTMLDocument2 *pHTMLDocument=NULL;&IPersistStreamInit *pPSI=NULL;&IStream *pStream=NULL; &HGLOBAL& hHTMLT &if (!(pHTMLDocument = (IHTMLDocument2*)m_pHtmlView-&m_browser.GetDocument()))& &&if (FAILED(pHTMLDocument-&QueryInterface(&pPSI)))&{//& pHTMLDocument-&Release();& &} &pHTMLDocument-&clear();&pPSI-&InitNew();&LPCTSTR strText = m_pSourceView-&LockBuffer();&DWORD dwLength = strlen(strText);&hHTMLText = GlobalAlloc(GMEM_FIXED, dwLength);&memset(hHTMLText, 0, dwLength);&memcpy(hHTMLText, strText, dwLength);&m_pSourceView-&UnlockBuffer();&CreateStreamOnHGlobal(hHTMLText, TRUE, &pStream); &ULARGE_INTEGER libNewS&libNewSize.QuadPart = dwL&pStream-&SetSize(libNewSize);这一步必须要,否则显示时会有多余字符出现&pPSI-&Load(pStream); &pStream-&Release();&pPSI-&Release(); // pHTMLDocument-&Release();}
请问 ie如何实现复制文字到剪贴板中?&
ie本身显示的不是文本文件但通过复制在剪贴板中保留的却是文本文件,难道也是拦截的api? 我应该怎么做!
IE复制的剪贴板内容有多种格式,比如text,html,image等等。http://expert.csdn.net/Expert/topic/.xml?temp=.6424677
&& 包含IE控件的问题(如何得到IE页面输入值)&
我想做一个包含IE控件的程序,然后在这个控件的页面上有几个文本框。请问:当这个页面提交时,我如何得到文本框中输入的值?
BOOL CDlgEdit::SaveData(){&_variant_t varV&try{& //given id?& if(m_varItemID.vt!=VT_CLSID){&& //new record,add new&& m_rst-&AddNew();& }& FieldsPtr pFields=m_rst-&F& FieldPtr pI& CString strFieldN& long lFields=pFields-&C& //for each field& for(long i=0;i&lFi++){&& pItem=pFields-&Item[i];&& strFieldName=(LPCTSTR)pItem-&N&& IHTMLInputTextElementPtr pE&& //get html element by id&& GetElementInterface(strFieldName,IID_IHTMLInputTextElement,reinterpret_cast &void**&(&pElement));&& if(pElement){&&& CComBSTR bstrFieldV&&& pElement-&get_value(&bstrFieldValue);&&& //if natural data type&&& CString strDataType=DataTypeGetFieldProperty(m_strDataType,strFieldName,"FieldType");&&& //clear before use&&& varVal=g_varE&&& if(strDataType.IsEmpty()){//default translate&&&& g_SetValueString(varVal,_bstr_t(bstrFieldValue),g_AdoType2VARTYPE(pItem-&Type));&&& }&&& else{//find alias or name&&&& g_SetValueString(varVal,_bstr_t(bstrFieldValue),strDataType,TRUE);&&& }&&& pItem-&Value=varV&& }& }&& & m_rst-&Update();&}&catch(_com_error &e){& ESErrPrintProviderError(g_connection);& ESErrPrintComError(e);& & return FALSE;&}&return TRUE;}说明m_strDataType 编辑对象的数据类型m_varItemID 编辑对象的ID(VT_CLSID或者VT_NULL类型)m_rst 编辑对象的记录集GetElementInterface 获得HTML元素的函数,定义可以在我的文章http://www.csdn.net/Develop/read_article.asp?id=14752中找到DataTypeGetFieldProperty 获得字段的数据类型g_SetValueString 根据数据类型设置字段的值g_AdoType2VARTYPE ADO数据类型和VARIANT数据类型的转换ESErrPrintProviderError和ESErrPrintComError是从MSDN ADO的示例中的函数g_PrintProviderError和g_PrintComError改编而来参考文档http://www.csdn.net/Develop/read_article.asp?id=9408http://www.csdn.net/Develop/read_article.asp?id=9408&那你要捕获Form的Submit事件,去看/shell/dlgdhtmlevents.asp/workshop/browser/mshtml/tutorials/sink.asp
如何得到IE的网页内容的cache位置(用什么函数)
我想从ie的cache的内容里得到下载下来的falsh文件。可如何得到IE的网页内容的cache位置,具体的平台,可以看到cache的位置,可用程序如何实现(用什么函数)
URLDownloadToCacheFileUsing this function ensures that a file name is returned without unnecessary copying of data.
如何知道在一个IE页面中,确定按钮被按下?&
/workshop/browser/mshtml/tutorials/sink.aspCOM的钩子就是Event sink我上面提到的那篇文章里就是讲这个的。http://www.csdn.net/develop/article/18/18998.shtm
用控件自制的ie浏览器,产生新窗口时,完全不在我的ie控件范围内,将我整个对话框都占了,我该怎样控制显示页面位置,
填写数据的话,可以看看在对话框中使用网页输入数据 (jiangsheng原创) http://www.csdn.net/develop/read_article.asp?id=9408我用的是DHTML控件,用webbeowser控件也是可以的,需要改一下代码。
请jiangsheng(蒋晟.Net)接分
8过以后这种问题还是直接贴出来让大家回答吧,一个人的意见不一定准确,大家一起来讨论比较好你这个问题偶还想收藏的说,说不定什么时候还有用(主要是下次抢分的时候直接贴链接用)1 .& 能否通过挂接事件连接点拦截脚本运行。如果可以是挂接哪一个接口。&&& 在IE对脚本进行解释运行前,IE插件能够得到通知,并能够阻止它运行。&&& 就像实现IShellExecuteHook接口拦截外壳程序运行一样。2.& 通过调用IHTMLElement的get_innerText,可以得到嵌入元素的整个文本。&& 那么怎么得到该文本中鼠标下的那个单词呢?
关于web控件在使用时的一个小问题,如何过滤掉提示信息对话框?&
使用web控件,通过该控件浏览已经保存在硬盘上的网页内容。有的时候浏览器会提示&出现了运行时错误,是否需要调试?&或者&你查看的网页正在试图关闭窗口,是否关闭窗口?&。有谁知道答案,谢谢
&www.csdn.net/develop/read_article.asp?id=196271为你的宿主程序实现IDocHostShowUI(重载MFC7的COleControlTontainer,或者使用微软知识库Q236312 HOWTO: Disable the Default Pop-up Menu for CHtmlView里面的方法)2 innerText
DHTML应用于windows Applicatoin界面?!讨论!&
开发过基于MFC的windows程序设计的朋友都知道,MFC提供的窗体效果和windows本身一样,无法提供很丰富的表现形式,也没有办法随便更改,虽然有一些界面组件和界面控件,例如cj60,activeSkin之类的,我觉得也不够灵活。有没有直接用HTML做界面,利用DHTML内部元素与应用程序交互的可能性呢?我已经看到一些程序使用了这些技术,通过IHTMLDocument接口,通过HTML hook技术来进行交互。可我很难在网上找到比较详尽的技术介绍,请问大家有什么自己的想法吗?!大家积极讨论,分大大的有!
sureNorton Antivirus UI is HTML pagesuse CDHtmlDialog for dialog based app and CHtmlView for SDI/MDIhttp://www.csdn.net/develop/read_article.asp?id=21702每一步都需要检查操作结果和返回的指针可以用res协议访问Yessee BEGIN_EVENTSINK_MAP in MFC
VC中如何调用Script中的函数?
脚本中传来的函数指针是LPDISPATCH,如果直接用ChangeType转为String,得到的结果是包含函数代码在内的整个函数而不是函数名[即便能通过分析来获得...],请问我要如何能够通过这个Dispatch指针来调用这个函数呢?难道只能生成一个调用字符串插入执行吗?
JavaScript Calls from C++/ieprogram/JSCalls.html通过GetTypeInfo可以获得类型信息参见http://www.csdn.net/develop/read_article.asp?id=21702HRESULT CIEAutomationView::DumpTypeInfo(LPDISPATCH pDisp){&if(pDisp==NULL)return OLE_E_BLANK;&CComPtr&ITypeInfo& pTypeI&HRESULT hr = S_OK;&hr= pDisp-&GetTypeInfo(0, GetUserDefaultLCID(), &pTypeInfo);&if(FAILED(hr))&CSmartTypeAttr pTypeAttr( pTypeInfo );&CSmartFuncDesc pFuncDesc( pTypeInfo );&hr= pTypeInfo-&GetTypeAttr( &pTypeAttr );&if(FAILED(hr))&for(int iMethod = 0; iMethod & pTypeAttr-&cF iMethod++){& hr= pTypeInfo-&GetFuncDesc(iMethod, &pFuncDesc);& if(FAILED(hr))& CString strInvokeT& switch(pFuncDesc-&invkind){& case INVOKE_FUNC&& :strInvokeType="Function";& case INVOKE_PROPERTYGET :strInvokeType="Property(Get)";& case INVOKE_PROPERTYPUT :strInvokeType="Property(Put)";& case INVOKE_PROPERTYPUTREF:strInvokeType="Property(Putref)";& default:& }& CComBSTR bstrN& unsigned int nN& hr= pTypeInfo-&GetNames(pFuncDesc-&memid, &bstrName, 1,&nNames );& if(FAILED(hr))& ASSERT( nNames == 1 );& TRACE("%s/t%s/r/n",CString(bstrName.m_str),strInvokeType);& pFuncDesc.Release();&}&return S_OK;}void CIEAutomationView::OnDocumentComplete(LPDISPATCH pDisp, LPCTSTR lpszUrl){&// make sure the main frame has the new URL.& This call also stops the animation&((CChildFrame*)GetParentFrame())-&SetAddress(lpszUrl);&CString strURL(lpszUrl); &IUnknown* pUnkBrowser = NULL;&&& IUnknown* pUnkDisp = NULL;&TRACE(_T("Document %s Done/r/n"),lpszUrl);&//is it top level document?&HRESULT hr = m_pBrowserApp-&QueryInterface( IID_IUnknown,& (void**)&pUnkBrowser);&if ( SUCCEEDED(hr) ){&&&&&&& hr = pDisp-&QueryInterface( IID_IUnknown,& (void**)&pUnkDisp );&&&&&&& if ( SUCCEEDED(hr) ){&&&&&&&&&&& if ( pUnkBrowser == pUnkDisp ){&&& //top level&&& m_spHtmlDoc=NULL;&&& hr=m_pBrowserApp-&get_Document(&m_spHtmlDoc);&&& TRACE(_T("Downloading Complete/r/n"),lpszUrl);&&& DumpTypeInfo(m_spHtmlDoc);&&& CComQIPtr&IHTMLDocument2& pHtmlDoc(m_spHtmlDoc);&&& IShellBrowser* pShellBrowser=(IShellBrowser*)m_wndBrowser.SendMessage(WM_USER+7,0,0);&&& if(pHtmlDoc){&&&& CComPtr&IHTMLWindow2& pW&&&& pHtmlDoc-&get_parentWindow(&pWindow);&&&& CComQIPtr&IDispatch& spWindow(pWindow);&&&& m_domExternal.SetMenuArguments(spWindow);&&& }&&& if(pShellBrowser){&&&& CComPtr&IShellView&& pIShellV&&&& pShellBrowser-&QueryActiveShellView(&pIShellView);&&&& if(pIShellView){&&&&& FOLDERSETTINGS&&&&& pIShellView-&GetCurrentInfo(&fs);&&&&& CComQIPtr&IFolderView&& pIFolderView(pIShellView);&&&&& if(pIFolderView){&&&&&& pIFolderView-&SetCurrentViewMode(FVM_DETAILS);&&&&& }&&&& }&&&& TRACE("Get Shell Browser/r/n");&&& }&& }&& pUnkDisp-&Release();& }& pUnkBrowser-&Release();&}}void CIEAutomationView::CallScript(IHTMLWindow2* pWindow2& ,BSTR bstrCode& ,BSTR bstrLanguage){&ASSERT(pWindow2);&HRESULT hr = S_OK;&COleV&hr = pWindow2-&execScript(bstrCode, bstrLanguage, &ret);}void CIEAutomationView::CallScriptDirect(IHTMLWindow2* pWindow2& ,BSTR bstrMethod){&DISPID dispidScriptObject, dispidMethodToI&IDispatch *pDispScriptO&DISPPARAMS dispparamsNoArgs = { NULL, NULL, 0, 0};&HRESULT&OLECHAR *szScript = L"script";&OLECHAR *szFuncName = bstrM&&IHTMLDocument2* pDocument2 = NULL;&hr = pWindow2-&get_document(&pDocument2);&ASSERT(SUCCEEDED(hr) && pDocument2);&IDispatch* pDocDisp = NULL;&hr = pDocument2-&QueryInterface(IID_IDispatch, (void**)&pDocDisp);&ASSERT(SUCCEEDED(hr) && pDocDisp);&// Get the DISPID of the document's Script property.&hr = pDocDisp-&GetIDsOfNames(IID_NULL, &szScript,& 1, LOCALE_USER_DEFAULT, &dispidScriptObject);&ASSERT(SUCCEEDED(hr));&COleVariant varR&&// Get the document's Script property.&hr = pDocDisp-&Invoke(dispidScriptObject,& IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET,& &dispparamsNoArgs, &varResult, NULL, NULL);&ASSERT(SUCCEEDED(hr) && varResult.pdispVal);&pDispScriptObject = varResult.pdispV&varResult.Clear(); &// Get the DISPID of the script method to invoke.&hr = pDispScriptObject-&GetIDsOfNames(IID_NULL, &szFuncName, 1, & LOCALE_USER_DEFAULT, &dispidMethodToInvoke);&ASSERT(SUCCEEDED(hr));&// Invoke the script method.&hr = pDispScriptObject-&Invoke(dispidMethodToInvoke, IID_NULL,& LOCALE_USER_DEFAULT, DISPATCH_METHOD, &dispparamsNoArgs, & &varResult, NULL, NULL);&ASSERT(SUCCEEDED(hr));&pDocDisp-&Release();&pDocument2-&Release();}
怎么得到IE容器包含的对象的服务的接口指针
我的IE页面:&OBJECT &OBJECT ID=p1 CLASSID="CLSID:B4-42A9-B954-003CEA26E0FC"&&/OBJECT&&iframe id=p2 HEIGHT=50% WIDTH=100% src=./11.doc& &/IFRAME&我页面上有一个我的p1控件,还有一个word服务器我想用我的p1去操作11.doc的Word服务器。我得到IE的IOleContainer容器接口,然后用IOleContainer::EnumObjects来枚举包含的对象。可以得到两个对象,一个是我自p1对象(可以得到IOleObject),一个却是iframe对象(能访问到IHTMLIFrameElement),但得到IHTMLIFrameElement后怎么也得到对应word的IOleObject或理Word对象_Documnet这些接口。我又用另一种方式,我先得到页面的IHTMLDocument2,再得到p2的IHTMLElement,但还是不能进而得到Word对象。有哪们大虾告诉我怎么才得到到IE容器内的Word对象接口?我500分谢。
使用Frame对象的IWebbrowser2接口(可以从IHTMLElement或者IHTMLIFrameElement查询)的document属性可以获得word.appacation对象的IDispatch接口http://www.csdn.net/develop/author/netauthor/jiangsheng/files/webbrowserAutomationsrc.zip用这个程序打开一个doc文档,然后看VC的output窗口的debug部分需要最新版本的platform SDK/msdownload/platformsdk/sdkupdate/IWebbrowser2::get_Documnet只在载入了文档之后才不为空装了之后要设置包含目录顺序的载入了文档就是顶层框架documentcomplete事件触发之后
***200分,如何取得链接所属的网页url和该链接名称?****
在FlashGet中可以做到,从IE中拖一个链接到FlashGet中,它能取得该链接所指向的url,还能取到引用Referer(即该链接所属网页的url,例http://www.xxx//xxx.html),和能取到注释Comment(即该链接的名称,例如'点这里下载-& 本地下载')而我用了网上某个类只能取到链接所指向的url,请教,不知如何才能取得链接所属的网页url和该链接名称?
The hyperlink objectA hyperlink object implements the IHlink interface and encapsulates four pieces of reference information: a moniker to
a string for the locati a friendly and additional parameters. The hyperlink object completely encapsulates the behavior of navigating to a referenced location. It also supports the ability to save and load itself through the IPersistStream interface, and the ability to be transferred through the clipboard or through drag-and-drop operations by means of IDataObject. A standard hyperlink object implementation is provided with the system, and it is not advisable to implement another version. A document can use the standard hyperlink object to represent hyperlinks within itself, thus encapsulating the work of navigating, saving, loading, dragging, dropping, cutting, and pasting hyperlinks. Standard hyperlink objects are created through the HlinkCreateFromData, HlinkCreateFromMoniker, HlinkCreateFromString, and OleLoadFromStream functions. The standard hyperlink object implements the IHlink, IPersistStream, and IDataObject interfaces. IHlink::GetHlinkSite MethodThe hyperlink containerA hyperlink container is a document or application that contains hyperlinks. The container supports hyperlinks by implementing the IHlinkSite interface and, if the container's objects can be targets of other hyperlinks, the IHlinkTarget interface. Note&& Generally, an object that acts as a hyperlink container can also act as a hyperlink target. An HTML page, for example, can contain a number of hyperlinks to other pages, while at the same time it can be the target of hyperlinks from other HTML pages. The hyperlink siteA hyperlink site is a COM object that implements the IHlinkSite interface and supplies either the moniker or interface identifier of its hyperlink container. One hyperlink site can serve multiple hyperlinks. The moniker supplied by the hyperlink site is used to evaluate relative monikers to the hyperlink target. If the relative moniker is NULL, the target of the link is in the same container object, and IHlink::Navigate can result in an efficient internal jump Note&& The standard hyperlink object performs internal jumps by retrieving the container's IHlinkTarget moniker using IHlinkTarget::GetMoniker (which avoids an unnecessary moniker bind). The object then asks the container to navigate directly through the IHlinkTarget::Navigate method
用VC如何获取网页中的链接和鼠标点击处的链接?
各位给个例子看看?
anchors Property (IHTMLDocument2)--------------------------------------------------------------------------------Retrieves an interface pointer to a zero-based collection of all the A objects in an HTML document. The elements are in the same order as they appear in the document. SyntaxHRESULT IHTMLDocument2::get_anchors(IHTMLElementCollection **p);activeElement Property (IHTMLDocument2)--------------------------------------------------------------------------------Retrieves the object that has the focus when the parent document has focus.SyntaxHRESULT IHTMLDocument2::get_activeElement(IHTMLElement **p);ParameterspAddress of a pointer to an IHTMLElement interface that receives the element that has the focus.Return ValueReturns S_OK if successful, or an error value otherwise. RemarksSet the active element with the setActive or focus methods. Using the setActive method has no effect on document focus. Using the focus method on an individual element causes the element to gain focus and become the active element.The active element remains the active element even when focus has been placed outside the parent document. If no particular object is given focus when focus returns to the parent document, then the active element will gain focus. Select the title bar of a different application and then select the initial browser title bar to confirm this. Focus is shifted to the other application initially, but returns to the same active element as before the selectionsee WorkAll Sample in Platform SDK.http://www.csdn.net/expert/topic/478/478341.shtm
怎样判断IE已经加载完成,并取得IDocument2指针,网页高手快来
源码如下:ShellExecute(NULL, _T("open"), "www.csdn.net", NULL,NULL, SW_HIDE|SW_MINIMIZE);hWnd=::FindWindow("IEFrame",NULL);&CoInitialize( NULL );&{ & 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& spD& LRESULT lR&& & 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 = (*pfObjectFromLresult)( lRes, IID_IHTMLDocument, 0, (void**)&spDoc );& if ( SUCCEEDED(hr) )& {&& CComPtr&IDispatch& spD&& CComQIPtr&IHTMLWindow2& spW&& && spDoc-&get_Script( &spDisp );&& spWin = spD&& spWin-&get_document( &spDoc.p);&& && // Change background color to red&& //spDoc-&put_bgColor( CComVariant("red") );&& //下面的代码填写登陆表单&& IHTMLElementCollection *objAllElement=NULL;&& spDisp.p=NULL;& // IHTMLDocument2 *objDocument=spD&& spDoc-&get_all(&objAllElement);objAllElement-&item(COleVariant("a"),COleVariant((long)0),&spDisp);//spDisp提示为空,表明没有找到"a",怎么回事&&&&&&&&&&&&&&&&&&&&&&&&&
主  题:MsHtml的问题作  者:111222所属论坛:Visual C++问题点数:300回复次数:36发表时间: 19:19:18&& 网页里&table&怎么找出来? http://www.csdn.net/expert/topic/351/351580.shtm原理是一样的啊通过DOM来访问元素HOWTO: Get IHTMLDocument2 from a HWND Q249232--------------------------------------------------------------------------------The information in this article applies to:Microsoft Internet Explorer (Programming) versions 4.0, 4.01, 4.01 SP1, 4.01 SP2, 5, 5.5Q I use the Active Accessibility SDK to obtain an IHTMLDoc-ument2 pointer from a window handle (HWND). Is there any way to obtain an IWebBrowser2 pointer from the IHTMLDocument2 pointer? I抳e tried QueryInterface on both the document pointer as well as the IHTMLWindow2 pointer without results. I also tried the IOmNavigator * from get_navigator on the HTMLWindow2 pointer. Any ideas? A This is a common cause for COM consternation. You have the window, document, or browser and you know you should be able to get the others, but everywhere you turn, QueryInterface delivers a big fat NULL. The answer lies in the mysterious IServiceProvider whose job it is, well, to provide services. IServiceProvider is a great interface: it has only one method, QueryService. If you抮e using ATL smart pointers, it looks like this. First, you have to get the IServiceProvider.CComQIPtr&IServiceProvider& isp = pIHTMLDocument2;This does a QueryInterface on the document for IServiceProvider. Once you have it, you can get the browser like so.CComQIPtr&IWebBrowser2& iwb2;isp-&QueryService(IID_IWebBrowserApp,&&& IID_IWebBrowser2, (void**)&iwb2);&&&&& If all this seems confusing, there抯 a good reason for it. A cardinal rule of COM is that QueryInterface must always return an interface to the object queried. But the document doesn抰 implement IWebBrowser2; it only knows how to get the object that does. The document, browser, and window are all separate objects. In general, IServiceProvider is used whenever a bunch of separate but related COM objects together implement some kind of service. QueryInterface asks an object, do you implement this interface? QueryService tells a service provider, "get me whatever object implements this interface, please." With QueryService, the interface pointer returned may or may not be the same object as the one queried. Figure 6 illustrates the system. All the objects implement their various interfaces and store internal poi IServiceProvider is your way to get whichever object implements a particular interface. IServiceProvider::QueryService chases the internal pointers to retrieve the object that implements the interface you want.Figure 6 Many Objects, One IServiceProvider&&&&& IServiceProvider is essential for navigating the DHTML object hierarchy. Say you抮e writing an ActiveX& control and you want to navigate the object model. How do you do it? First, query your IOleClientSite for IServiceProvider like so:CComQIPtr&IServiceProvider& isp = pSthen, once you have IServiceProvider, you can QueryService it for the application object.CComQIPtr&IWebBrowserApp&isp-&QueryService(IID_IWebBrowserApp, &&& IID_IWebBrowserApp, (void **)&iwba); Now you can navigate the object hierarchy (the app object is at the top). If you want the Web browser, it抯 the same as before.CComQIPtr&IWebBrowser2& iwb2;isp-&QueryService(IID_IWebBrowserApp, &IID_IWebBrowser2, (void **)&iwb2)); &&&&& In all these examples, SID_SWebBrowserApp identifies the service, but you抣l often see code that uses IID_IWebBrowserApp as the service ID. Either will work, since &shlguid.h& #defines SID_SWebBrowserApp to IID_IWebBrowserApp, but for programming pedants SID_SWebBrowserApp is technically more correct, and more clear to anyone reading your code.&&&&& By the way, if you抮e brave enough to implement some far-reaching colossal object system such as the DHTML object model (Lord help you!), then you should implement IServiceProvider too.webbrowser没初始化完的话,IHTMLDocument2是空。也就是说,新的IE窗口在一段时间内肯定没有文档(要是默认主页很大的话,这个时间可以很长)看来要用BHO解决了。
IE6编程问题,真的是难呀!不是高手就别浪费时间了,100分!(决无贬义,只求广告效应)
调用IE的ExecWB(...)想弹出&另存为&的窗口,&& CHtmlView.ExecWB OLECMDID_SAVEAS,& OLECMDEXECOPT_DODEFAULT但是& & 我不想显示弹出的&另存为&的窗口,还想存为下拉框中的某种非默认格式,& 如何实现?难吧!& 请指教。& 谢谢!
&主  题:& 超超超超超级难题!!!!给你10个URL,你能把自动他们都存成*.mht文件吗?????? 作  者:& 111222 (张小白)& &http://www.csdn.net/expert/topic/786/786376.xml&回复人: masterz() (& ) 信誉:98&
17:42:45& 得分:300& &&& #import "c:/program files/common files/system/ado/msado15.dll" no_namespace rename("EOF", "EndOfFile")#import &cdosys.dll& no_namespace rename("EOF", "EndOfFile")............void CSavemhtDlg::OnOK() {&// save url as a single file, in fact I don't know if it is mht file, but it can be opened by IE, can someone tell me?&CoInitialize(NULL);&{& IMessagePtr&&&&&& iMsg(__uuidof(Message));& IConfigurationPtr iConf(__uuidof(Configuration));& iMsg-&Configuration = iC& try& {&&& iMsg-&CreateMHTMLBody(&&&&&& "", &&&&&& cdoSuppressNone,&&&&&& "domain//username",&&&&&& "password");& }& catch(_com_error err)& {&&& // handle exception& } & _StreamPtr pStream=iMsg-&GetStream();& pStream-&SaveToFile("test.mht",adSaveCreateOverWrite);&}&CoUninitialize();}&&
如何获得对网页上按钮之类控制的消息?(在VC里)
如在里使用IE控件作浏览网站的东东时,如何得到对网页按钮的点击消息呢?
Receiving Element EventsEach element in the DHTML Object Model supports an outgoing HTMLElementEvents2 interface. This interface defines the events that an HTML element can fire. You implement this interface to provide an event sink, which is a Component Object Model (COM) object that implements an outgoing interface and is used as the mechanism for firing events.Note& Interfaces implemented by a server usually have their methods called by the client, but to fire an event, the server calls the respective method on the client event sink. These interface are called outgoing interfaces. A COM object that implements an outgoing interface is also known as a connectable object.The following steps are required to receive events from an outgoing interface:Implement the event sink.The event sink implements the appropriate outgoing interface and methods. Internet Explorer event interfaces are dispinterfaces, so calls to event methods are made through IDispatch::Invoke . This means that you only need to implement the IDispatch interface to handle events.Determine if the server is a connectable object.Call QueryInterface& to retrieve a pointer to the IConnectionPointContainer& interface.Find the appropriate connection point. Call the IConnectionPointContainer::FindConnectionPoint& method to find the connection point you need. For Internet Explorer WebBrowser Control events, such as DWebBrowserEvents2::DocumentComplete, this is DWebBrowserEvents2. For element events, this is HTMLElementEvents2. You can also call the IConnectionPointContainer::EnumConnectionPoints& to enumerate through all the connection points a server supports.Advise the connection point that you want to receive events.Using the IConnectionPoint& interface pointer returned in the previous step, call IConnectionPoint::Advise , passing the IUnknown& interface pointer of your event sink.&Note& The connectable object will use the IUnknown interface pointer to query the client for the event sink interface. If the event sink does not support the outgoing interface, Internet Explorer will query the client for the IDispatch interface.When you no longer want to receive events, you can call the IConnectionPoint::Unadvise& method, passing the cookie you received from the call to IConnectionPoint::AdviseThe following sample code demonstrates how to begin receiving HTML element events for an element on an HTML page.void CMyClass::ConnectEvents(IHTMLElement* pElem){&&& HRESULT&&& IConnectionPointContainer* pCPC = NULL;&&& IConnectionPoint* pCP = NULL;&&& DWORD dwC&&& // Check that this is a connectable object.&&& hr = pElem-&QueryInterface(IID_IConnectionPointContainer, (void**)&pCPC);&&& if (SUCCEEDED(hr))&&& {&&&&&&& // Find the connection point.&&&&&&& hr = pCPC-&FindConnectionPoint(DIID_HTMLElementEvents2, &pCP);&&&&&&& if (SUCCEEDED(hr))&&&&&&& {&&&&&&&&&&& // Advise the connection point.&&&&&&&&&&& // pUnk is the IUnknown interface pointer for your event sink&&&&&&&&&&& hr = pCP-&Advise(pUnk, &dwCookie);&&&&&&&&&&& if (SUCCEEDED(hr))&&&&&&&&&&& {&&&&&&&&&&&&&&& // Successfully advised&&&&&&&&&&& }&&&&&&&&&&& pCP-&Release();&&&&&&& }&&&&&&& pCPC-&Release();&&& }} The following sample code demonstrates how you would detect the firing of an HTMLElementEvents2::onclick event in your implementation of IDispatch::Invoke.Hide ExampleSTDMETHODIMP CEventSink::Invoke(DISPID dispidMember,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& REFIID riid,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& LCID lcid,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& WORD wFlags,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& DISPPARAMS* pdispparams,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& VARIANT* pvarResult,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& EXCEPINFO* pexcepinfo,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& UINT* puArgErr){&&& switch (dispidMember)&&& {&&&&&&& case DISPID_HTMLELEMENTEVENTS2_ONCLICK:&&&&&&& OnClick();&&&&&&& &&&&&&& default:&&&&&&& &&& }&&& return S_OK;}
masterz,111222过来看看,BHO中判断网页下载完成的问题
我要处理网页中多Frame的情况。在ATL中:STDMETHODIMP CSpyIE::Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pvarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr){&&& case DISPID_NAVIGATECOMPLETE2:&& {&&&&& ...&& }& }调试发现括号中的内容会执行多次。参考了MSDN:HOWTO: Determine When a Page Is Done Loading in WebBrowser Control (Q180366)在ATL中该怎样判断??
Figure 9&&& Invoke STDMETHODIMP CIEHlprObj::Invoke(DISPID dispidMember, REFIID riid,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& LCID lcid, WORD wFlags,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& DISPPARAMS* pDispParams,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& VARIANT* pvarResult,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& EXCEPINFO*& pExcepInfo, UINT* puArgErr){&& USES_CONVERSION;&& strstream strEventI&& if (!pDispParams)&&&&& return E_INVALIDARG;&& // Get the current URL&& //& && LPOLESTR lpURL = NULL;&& m_spWebBrowser2-&get_LocationURL(&lpURL);&& switch (dispidMember)&& {&&&&& // The parameters for this DISPID are as follows:&&&&& // [0]: Cancel flag& - VT_BYREF|VT_BOOL&&&&& // [1]: HTTP headers - VT_BYREF|VT_VARIANT&&&&& // [2]: Address of HTTP POST data& - VT_BYREF|VT_VARIANT &&&&& // [3]: Target frame name - VT_BYREF|VT_VARIANT &&&&& // [4]: Option flags - VT_BYREF|VT_VARIANT&&&&& // [5]: URL to navigate to - VT_BYREF|VT_VARIANT&&&&& // [6]: An object that evaluates to the top-level or frame&&&&& //&&&&& WebBrowser object corresponding to the event. &&&&& //&&&&& case DISPID_BEFORENAVIGATE2:&&&&&&&& strEventInfo && "BeforeNavigate2: ";&&&&&&&& if (pDispParams-&cArgs &= 5 &&&&&&&&&&&&&& pDispParams-&rgvarg[5].vt == (VT_BYREF|VT_VARIANT))&&&&&&&& {&&&&&&&&&&& CComVariant varURL(*pDispParams-&rgvarg[5].pvarVal);&&&&&&&&&&& varURL.ChangeType(VT_BSTR);&&&&&&&&&&& strEventInfo && OLE2T(varURL.bstrVal);&&&&&&&& }&&&&&&&& else&&&&&&&&&&& strEventInfo && "NULL";&&&&&&&& strEventInfo &&&&&&&&&& &&&&& // The parameters for this DISPID:&&&&& // [0]: URL navigated to - VT_BYREF|VT_VARIANT&&&&& // [1]: An object that evaluates to the top-level or frame&&&&& //&&&&& WebBrowser object corresponding to the event. &&&&& //&&&&& case DISPID_NAVIGATECOMPLETE2:&&&&&&&& if (pDispParams-&rgvarg[0].vt == (VT_BYREF|VT_VARIANT))&&&&&&&& {&&&&&&&&&&& CComVariant varURL(*pDispParams-&rgvarg[0].pvarVal);&&&&&&&&&&& varURL.ChangeType(VT_BSTR);& &&&&&&&&&&& strEventInfo && "NavigateComplete2: "&&&&&&&&&&&&&&&&&&&&&&&& && OLE2T(varURL.bstrVal)&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&& }&&&&&&&& &&&&& // The parameters for this DISPID:&&&&& // [0]: New status bar text - VT_BSTR&&&&& //&&&&& case DISPID_STATUSTEXTCHANGE:&&&&&&&& LPOLESTR lpStatusT&&&&&&&& m_spWebBrowser2-&get_StatusText(&lpStatusText);&&&&&&&& strEventInfo && "StatusTextChange: ";&&&&&&&& if (!strcmp(OLE2T(lpStatusText), ""))&&&&&&&&&&& strEventInfo && "NULL";&&&&&&&& else&&&&&&&&&&& strEventInfo && OLE2T(lpStatusText);&&&&&&&& strEventInfo &&&&&&&&&& &&&&& // The parameters for this DISPID:&&&&& // [0]: Maximum progress - VT_I4&&&&& // [1]: Amount of total progress - VT_I4&&&&& //&&&&& case DISPID_PROGRESSCHANGE:&&&&&&&& strEventInfo && "ProgressChange: ";&&&&&&&& if (pDispParams-&cArgs == 0)&&&&&&&&&&& strEventInfo && "NULL";&&&&&&&& else&&&&&&&& {&&&&&&&&&&& if (pDispParams-&rgvarg[0].vt == VT_I4)&&&&&&&&&&&&&& strEventInfo && pDispParams-&rgvarg[0].lV&&&&&&&&&&& if (pDispParams-&cArgs & 1 && pDispParams-&rgvarg[1].vt == VT_I4)&&&&&&&&&&&&&& strEventInfo && ", " && pDispParams-&rgvarg[1].lV&&&&&&&& }&&&&&&&& strEventInfo &&&&&&&&&& &&&&& case DISPID_DOCUMENTCOMPLETE:&&&&&&&& strEventInfo && "DocumentComplete" &&&&&&&&&& &&&&& case DISPID_DOWNLOADBEGIN:&&&&&&&& strEventInfo && "DownloadBegin" &&&&&&&&&& &&&&& case DISPID_DOWNLOADCOMPLETE:&&&&&&&& strEventInfo && "DownloadComplete" &&&&&&&&&& &&&&& // The parameters for this DISPID:&&&&& // [0]: Enabled state - VT_BOOL&&&&& // [1]: Command identifier - VT_I4&&&&& //&&&&& case DISPID_COMMANDSTATECHANGE:&&&&&&&& strEventInfo && "CommandStateChange: ";&&&&&&&& if (pDispParams-&cArgs == 0)&&&&&&&&&&& strEventInfo && "NULL";&&&&&&&& else&&&&&&&& {&&&&&&&&&&& if (pDispParams-&rgvarg[0].vt == VT_BOOL)&&&&&&&&&&&&&& strEventInfo && ((pDispParams-&rgvarg[0].boolVal == &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& VARIANT_TRUE) ? "True" : "False");&&&&&&&&&&& if (pDispParams-&cArgs & 1 && pDispParams-&rgvarg[1].vt == VT_I4)&&&&&&&&&&&&&& strEventInfo && ", " && pDispParams-&rgvarg[1].lV&&&&&&&& }&&&&&&&& strEventInfo &&&&&&&&&& &&&&& case DISPID_NEWWINDOW2:&&&&&&&& strEventInfo && "NewWindow2" &&&&&&&&&& &&&&& // The parameters for this DISPID:&&&&& // [0]: Document title - VT_BSTR&&&&& //&&&&& case DISPID_TITLECHANGE:&&&&&&&& strEventInfo && "TitleChange: ";&&&&&&&& if (pDispParams-&cArgs & 0 && pDispParams-&rgvarg[0].vt == VT_BSTR)&&&&&&&&&&& strEventInfo && OLE2T(pDispParams-&rgvarg[0].bstrVal);&&&&&&&& else&&&&&&&&&&& strEventInfo && "NULL";&&&&&&&& strEventInfo &&&&&&&&&& &&&&& // The parameters for this DISPID:&&&&& // [0]: Name of property that changed - VT_BSTR&&&&& //&&&&& case DISPID_PROPERTYCHANGE:&&&&&&&& strEventInfo && "PropertyChange: ";&&&&&&&& if (pDispParams-&cArgs & 0 && pDispParams-&rgvarg[0].vt == VT_BSTR)&&&&&&&&&&& strEventInfo && OLE2T(pDispParams-&rgvarg[0].bstrVal);&&&&&&&& else&&&&&&&&&&& strEventInfo && "NULL";&&&&&&&& strEventInfo &&&&&&&&&& &&&&& // The parameters for this DISPID:&&&&& // [0]: Address of cancel flag - VT_BYREF|VT_BOOL&&&&& //&&&&& case DISPID_QUIT:&&&&&&&& strEventInfo && "Quit" &&&&&&&&&& ManageConnection(Unadvise);&&&&&&&& m_dlgEvents.DestroyWindow();&&&&&&&& &&&&& default:&&&&&&&& strEventInfo && "Unknown Event" && dispidMember &&&&&&&&&& && }&& m_dlgEvents.AddEventToList(strEventInfo.str());&& return S_OK;}
如何获得iframe的句柄?
是接口吧这个依赖于IE的版本的http://www.csdn.net/Expert/TopicView.asp?id=704159
★☆怎样用vc编程来保存XML的网页?★☆
BOOL DOMDocSaveLocation(){&& BOOL bResult = FALSE;&& IXMLDOMDocument *pIXMLDOMDocument = NULL;&& HRESULT&& try&& {&&&&& _variant_t varString = _T("D://sample.xml");&&&&& // Initialize pIXMLDOMDocument (create a DOMDocument).&&&&& // Load document.&&&&& hr = pIXMLDOMDocument-&save(varString);&&&&& if(SUCCEEDED(hr))&&&&&&&& bResult = TRUE;&& }&& catch(...)&& {&&&&& DisplayErrorToUser();&& // Release the IXMLDOMDocument interface.&& }&& // Release the IXMLDOMDocument interface when finished with it.&& return bR}http://www.csdn.net/expert/topic/783/783799.xml
想IE窗口发消息的问题(在线等)
我想向一个IE窗口发送一个字符串。用spy++观察,窗口结构如下:CabinetWClass& Shell DocObject View&&& Internet Explorer_Server&&&&& Shell Embedding&&&&& Shell Embedding&&&&& Shell Embedding&&&&& Shell Embedding&&&&& Shell DocObject View&&&&&&& Internet Explorer_Server在最后的窗口上有一个编辑框,但是看不到这个edit。用FindWindow(),FindWindowEx(),GetNextWindow(),最后可以得到有edit的窗口的hwnd。往这个hwnd发送WM_KEYDOWN时,edit中有字符出现。可是我不能一个一个字符的发啊,我想一次发送一个字符串,不知道该怎样去做?
HRESULT IHTMLInputButtonElement::put_value(BSTR v);HOWTO: Get IHTMLDocument2 from a HWND Q249232然后枚举文档元素,获得IHTMLInputButtonElement接口。http://www.csdn.net/expert/topic/351/351580.xmlhttp://www.csdn.net/Expert/topicview.asp?id=653919
怎样在程序中往历史记录里添加新的记录
我想在程序中往历史记录中添加新的记录,然后在IE的历史中能看到象:星期一,下面是网站,再往下是网页&
开一个隐藏的IE,然后浏览&&VARIANT vDummy = {0};// Instantiate a browser&& if (FAILED(hr = CoCreateInstance(CLSID_InternetExplorer,&&&&& NULL, CLSCTX_SERVER, IID_IWebBrowser2,&&&&&&&&&&&&&&&&&&& (LPVOID*)&pWebBrowser)))&& {&&&&& goto E&& }&& // Show the browser, and navigate to the special location&& // represented by the pidl&& hr = pWebBrowser-&put_Visible(VARIANT_FALSE);&& hr = pWebBrowser-&Navigate2(&vPIDL, &vDummy, &vDummy,&&&&&&&&&& &vDummy, &vDummy);
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:340091次
积分:4123
积分:4123
排名:第2578名
原创:24篇
转载:331篇
评论:74条
(1)(1)(8)(1)(1)(1)(2)(1)(2)(2)(4)(36)(1)(4)(1)(10)(5)(2)(3)(1)(2)(11)(1)(1)(2)(2)(12)(3)(2)(5)(4)(6)(3)(4)(18)(1)(3)(4)(2)(34)(15)(5)(5)(7)(7)(5)(3)(2)(2)(18)(3)(1)(7)(14)(12)(2)(2)(1)(3)(1)(1)(4)(2)(7)(5)(2)(4)(2)(1)(6)

我要回帖

更多关于 征途2s是什么 的文章

 

随机推荐