编写Windows Mobile上基于WTL封装的CHTMLCtrl程序注意事项(备忘)

    技术2022-05-13  8

    Link: http://blog.csdn.net/cjwn/archive/2009/03/09/3973720.aspx

     

    WTL::CHtmlCtrl这个类,WTL文档中很少有说明,故把这些写下来备忘。

     

        根据WTL 8.0 Final 版本ReadMe.html中的描述,CHtmlCtrl只是把Win32 API的HTML View Control的Handle封装成一个client类。

     

    Windows Template Library

    Class Overview

     

    usage:        mi base   -   a base class (multiple inheritance) client   -   wrapper class for a handle as-is   -   to be used directly impl   -   implements a window (has WindowProc) or other support helper   -   a helper class base   -   implementation base class

     

    class name:usage:description:

     

    CHtmlCtrlclientHTML control

     

    1. 在CHtmlControl::AddText()之后需要调用CHtmlControl::EndofSource()函数通知控件。否则显示一个HTML sourcecode会要等很久。

     

    2. 需要在工程文件中包含以下头文件和库:

    #include "piedocvw.h" // for DWebBrowserEvents2 #include "webvw.h" // for IPIEHTMLDocument // May be you need the following libs in link settings. piedocvw.lib htmlview.lib webview.lib

     

    3. IWebBrowser2 的接口在Windows Mobile 6上是不支持的。

    IWebBrowser2 *pWebBrowser2= NULL; // No Interface on Windows Mobile 6

     

    4. 如果链接时候(Link)出现 IDD_IPIEHTMLDocument 未定义的错误,需要在源代码中添加对于IDD的定义。

    // For fixing the following linking error: // IExchangeRateFrame.obj : error LNK2001: unresolved external symbol IID_IPIEHTMLDocument #ifndef __IID_DEFINED__ #define __IID_DEFINED__ typedef struct _IID { unsigned long x; unsigned short s1; unsigned short s2; unsigned char c[8]; } IID; #endif // __IID_DEFINED__ #ifndef CLSID_DEFINED #define CLSID_DEFINED typedef IID CLSID; #endif // CLSID_DEFINED // from webvw.h MIDL_INTERFACE("CDD75622-07D9-11D3-9309-00C04FAE2101") const IID IID_IPIEHTMLDocument = {0xCDD75622, 0x07D9, 0x11D3, {0x93,0x09,0x00,0xC0,0x4F,0xAE,0x21,0x01}}; // End of Fixing


    最新回复(0)