zoukankan      html  css  js  c++  java
  • [IE编程] 多页面基于IE内核浏览器的代码示例

    有不少人发信问这个问题,我把答案贴在这里: 建议参考 WTL (Windows Template Library) 的代码示例工程TabBrowser  (在WTL目录/Samples/TabBrowser 下面)。该工程演示了如何用WTL + IE WebBrowser接口开发一个多Tab的IE内核浏览器, 并演示如何用ATL的IDispEventSimpleImpl监听DWebBrowserEvents2 事件, 代码简洁易懂,很有参考价值。

    WTL 是微软的开源项目,可以去 http://wtl.sourceforge.net/ 上下载。

    TabBrowser 代码在Visual Studio 2008 上会有编译错误

    1>c:/projects/wtl80/samples/tabbrowser/stdafx.h(33) : error C2065: '_stdcallthunk' : undeclared identifier
    1>c:/projects/wtl80/samples/tabbrowser/stdafx.h(33) : error C2070: ''unknown-type'': illegal sizeof operand

    解决方案: 在stdafx.h 里面加入#include <atlstdthunk.h>

    #include <atlbase.h>
    #include <atlstdthunk.h>  // 插入这行代码可以解决VS2008 下的编译错误

    #ifdef _VC80X
      // Support for VS2005 Express & SDK ATL
      namespace ATL
      {
     inline void * __stdcall __AllocStdCallThunk()
     {
      return ::HeapAlloc(::GetProcessHeap(), 0, sizeof(_stdcallthunk));
     }

     inline void __stdcall __FreeStdCallThunk(void *p)
     {
      ::HeapFree(::GetProcessHeap(), 0, p);
     }
      };
    #endif // _VC80X

    截图:

    开发基于IE8内核浏览器

    如果想用MFC而不用ATL/WTL, MSDN 上有一个MFCIE 的代码示例工程值得参考

    http://msdn.microsoft.com/en-us/library/ms177540(VS.80).aspx

    另外, Codeproject 上有一篇文章"WTL Browser"也不错 http://www.codeproject.com/KB/wtl/wtlbrowser.aspx 

  • 相关阅读:
    [LeetCode]Reverse Linked List II
    [LeetCode]Move Zeroes
    Next Greater Element I
    Keyboard Row
    Number Complement
    SQL语句学习(二)
    SQL语句学习(一)
    jQuery学习(三)
    jQuery学习(二)
    JQuery学习(一)
  • 原文地址:https://www.cnblogs.com/mvc2014/p/3775973.html
Copyright © 2011-2022 走看看