⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wtl for mfc programmers, part vi.mht

📁 大家知道wtl是window UI库
💻 MHT
📖 第 1 页 / 共 5 页
字号:
              <TR vAlign=3Dtop>
                <TD><IMG height=3D16=20
                  =
src=3D"http://www.codeproject.com/script/images/support_icon.gif"=20
                  width=3D16></TD>
                <TD class=3DsmallText><A=20
                  href=3D"http://www.codeproject.com/store/"><B>VS.NET =
2003 from=20
                  $899</B></A></TD></TR>
              <TR vAlign=3Dtop>
                <TD><IMG height=3D16=20
                  =
src=3D"http://www.codeproject.com/script/images/support_icon.gif"=20
                  width=3D16></TD>
                <TD class=3DsmallText><A=20
                  href=3D"http://www.codeproject.com/store/"><B>MSDN =
Univ. from=20
                  $1950</B></A></TD></TR>
              <TR vAlign=3Dtop>
                <TD></TD>
                <TD></TD></TR>
              <TR vAlign=3Dtop>
                <TD><IMG height=3D16=20
                  src=3D"http://www.codeproject.com/images/print.gif" =
width=3D16></TD>
                <TD class=3DsmallText><A=20
                  =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp?print=3Dtrue"=20
                  target=3D_print>Print version</A></TD></TR>
              <TR vAlign=3Dtop>
                <TD><IMG height=3D16=20
                  src=3D"http://www.codeproject.com/images/link.gif" =
width=3D16></TD>
                <TD class=3DsmallText><A=20
                  =
href=3D"http://www.codeproject.com/script/profile/add_bookmark.asp?t=3D0&=
amp;ct=3D%2Fwtl%2Fwtl4mfc6%2Easp&amp;guid=3DWTL4MFC6%2Fwtl5%2F20%2F2003">=
Bookmark=20
                  this</A></TD></TR></TR>
              <TR vAlign=3Dtop>
                <TD><IMG height=3D16=20
                  src=3D"http://www.codeproject.com/images/mail.gif" =
width=3D16></TD>
                <TD class=3DSmallText><A=20
                  =
href=3D"http://www.codeproject.com/script/recommend/form.asp?guid=3DWTL4M=
FC6%2Fwtl5%2F20%2F2003">Send=20
                  to a friend</A></TD></TR>
              <TR vAlign=3Dtop>
                <TD></TD>
                <TD></TD></TR>
              <TR vAlign=3Dtop>
                <TD></TD>
                <TD class=3DInfoBarHeader>My Profile</TD></TR>
              <TR>
                <TD bgColor=3Dblack colSpan=3D2><IMG height=3D1=20
                  src=3D"http://www.codeproject.com/images/space.gif"=20
              width=3D1></TD></TR>
              <TR vAlign=3Dtop>
                <TD><IMG height=3D16=20
                  =
src=3D"http://www.codeproject.com/images/profile_small.gif"=20
                  width=3D16></TD>
                <TD class=3DsmallText><A=20
                  =
href=3D"http://www.codeproject.com/script/profile/modify.asp?ct=3D/wtl/wt=
l4mfc6.asp">My=20
                  Settings</A></TD></TR>
              <TR vAlign=3Dtop>
                <TD><IMG height=3D16=20
                  =
src=3D"http://www.codeproject.com/images/submit_small.gif"=20
                  width=3D16></TD>
                <TD class=3DsmallText><A=20
                  =
href=3D"http://www.codeproject.com/script/articles/list_articles.asp?user=
id=3D273403">My=20
                  Articles</A></TD></TR>
              <TR vAlign=3Dtop>
                <TD><IMG height=3D16=20
                  =
src=3D"http://www.codeproject.com/images/bookmarks.gif"=20
                width=3D16></TD>
                <TD class=3DsmallText><A=20
                  =
href=3D"http://www.codeproject.com/script/profile/bookmark_list.asp">My=20
                  Bookmarks</A></TD></TR>
              <TR vAlign=3Dtop>
                <TD><IMG height=3D16=20
                  =
src=3D"http://www.codeproject.com/images/logoff_small.gif"=20
                  width=3D16></TD>
                <TD class=3DsmallText><A=20
                  =
href=3D"http://www.codeproject.com/script/profile/logoff.asp?ct=3D/wtl/wt=
l4mfc6.asp">Sign=20
                  out</A></TD></TR>
              <TR>
                <TD bgColor=3Dblack colSpan=3D2><IMG height=3D1=20
                  src=3D"http://www.codeproject.com/images/space.gif"=20
              width=3D1></TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD>&nbsp;</TD></TR>
        <TR>
          <TD>
            <CENTER>
            <SCRIPT language=3DJavaScript=20
            =
src=3D"http://www.codeproject.com/script/admentor/include/flashad.js"></S=
CRIPT>

            <SCRIPT language=3DJavaScript>
document.write(FlashAdText('/script/admentor/images/Sky_DevCenter.swf',
                           =
'http://www.codeproject.com/specials.asp?id=3D610',
                           '/script/admentor/images/Sky_DevCenter.JPG',
                           120,600));
</SCRIPT>
            <BR></CENTER><BR></TD></TR></TBODY></TABLE></TD>
    <TD width=3D5 rowSpan=3D2><IMG height=3D1=20
      src=3D"http://www.codeproject.com/images/space.gif" width=3D5> =
</TD>
    <TD align=3Dright width=3D"100%" bgColor=3Dwhite>
      <TABLE width=3D"100%">
        <TBODY>
        <TR>
          <TD class=3DsmallText vAlign=3Dtop noWrap></TD>
          <TD noWrap align=3Dright><A name=3D__top></A>
            <TABLE>
              <TBODY>
              <TR>
                <TD class=3DsmallText align=3Dright>46 members have =
rated this=20
                  article. Result:</TD>
                <TD>
                  <TABLE cellSpacing=3D0 cellPadding=3D0 border=3D2>
                    <TBODY>
                    <TR>
                      <TD><IMG height=3D5=20
                        =
src=3D"http://www.codeproject.com/script/images/red.gif"=20
                        width=3D20 border=3D0></TD>
                      <TD><IMG height=3D5=20
                        =
src=3D"http://www.codeproject.com/script/images/red.gif"=20
                        width=3D20 border=3D0></TD>
                      <TD><IMG height=3D5=20
                        =
src=3D"http://www.codeproject.com/script/images/red.gif"=20
                        width=3D20 border=3D0></TD>
                      <TD><IMG height=3D5=20
                        =
src=3D"http://www.codeproject.com/script/images/red.gif"=20
                        width=3D20 border=3D0></TD>
                      <TD><IMG height=3D5=20
                        =
src=3D"http://www.codeproject.com/script/images/red.gif"=20
                        width=3D15 border=3D0><IMG height=3D5=20
                        =
src=3D"http://www.codeproject.com/script/images/white.gif"=20
                        width=3D5 =
border=3D0></TD></TR></TBODY></TABLE></TD></TR>
              <TR>
                <TD class=3DsmallText align=3Dright colSpan=3D2><A=20
                  title=3D"Calculated as rating x Log10(# votes)"=20
                  =
href=3D"http://www.codeproject.com/script/articles/top_articles.asp?st=3D=
2">Popularity:=20
                  7.87</A>. Rating: <B>4.74</B> out of=20
        5.</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
  <TR>
    <TD vAlign=3Dtop width=3D"100%">
      <DIV id=3Dcontentdiv><!-- Article Starts -->
      <UL class=3Ddownload>
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/WTL4MFC6/WTL4MFC6_demo.zip">Downlo=
ad=20
        demo project - 64KB</A> </LI></UL><!-- Add the rest of your HTML =
here -->
      <H2>Contents</H2>
      <UL>
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#intro">Introduction</=
A>=20

        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#appwizard">Starting=20
        with the AppWizard</A>=20
        <UL>
          <LI><A=20
          =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#createproject">Creati=
ng=20
          the project</A>=20
          <LI><A=20
          =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#appwizcode">The=20
          generated code</A> </LI></UL>
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#addreseditor">Adding =

        Controls with the Resource Editor</A>=20
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#atlhostclasses">ATL=20
        Classes for Control Hosting</A>=20
        <UL>
          <LI><A=20
          =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#CAxDialogImpl">CAxDia=
logImpl</A>=20

          <LI><A=20
          =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#AtlAxWin">AtlAxWin=20
          and CAxWindow</A> </LI></UL>
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#callmethods">Calling =

        the Methods of a Control</A>=20
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#sinkevents">Sinking=20
        Events Fired by a Control</A>=20
        <UL>
          <LI><A=20
          =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#changemaindlg">Change=
s=20
          to CMainDlg</A>=20
          <LI><A=20
          =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#writesinkmap">Writing=
=20
          the sink map</A>=20
          <LI><A=20
          =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#writehandler">Writing=
=20
          event handlers</A> </LI></UL>
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#sampleoverview">Overv=
iew=20
        of the Sample Project</A>=20
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#runtimecreating">Crea=
ting=20
        an ActiveX Control at Run Time</A>=20
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#keyboard">Keyboard=20
        Handling</A>=20
        <LI><A =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#upnext">Up=20
        Next</A>=20
        <LI><A=20
        =
href=3D"http://www.codeproject.com/wtl/wtl4mfc6.asp#revisionhistory">Revi=
sion=20
        History</A> </LI></UL>
      <H2><A name=3Dintro></A>Introduction</H2>
      <P>Here in Part VI, I'll cover ATL's support for hosting ActiveX =
controls=20
      in dialogs. Since ActiveX controls are ATL's specialty, there are =
no=20
      additional WTL classes involved. However, the ATL way of hosting =
is rather=20
      different from the MFC way, so this is an important topic to =
cover. I will=20
      cover how to host controls and sink events, and develop an =
application=20
      that loses no functionality compared to an MFC app written with=20
      ClassWizard. You can, naturally, use the ATL hosting support in =
the WTL=20
      apps that you write.</P>
      <P>The sample project for this article demonstrates how to host =
the IE web=20
      browser control. I chose the browser control for two good =
reasons:</P>
      <OL>
        <LI>Everybody has it on their computers, and=20
        <LI>It has many methods and fires many events, so it's a good =
control to=20
        use for demonstration purposes. </LI></OL>
      <P>I certainly can't compete with folks who have spent tons of =
time=20
      writing custom browsers around the IE web browser control. =
However, after=20
      reading through this article, you'll know enough to start working =
on a=20
      custom browser of your own!</P>
      <H2><A name=3Dappwizard></A>Starting with the AppWizard</H2>
      <H3><A name=3Dcreateproject></A>Creating the project</H3>
      <P>The WTL AppWizard can create an app for us that is ready to =
host=20
      ActiveX controls. We'll start with a new project, this one will be =
called=20
      <I>IEHoster</I>. We'll use a modeless dialog as in the last =
article, only=20
      this time check the <I>Enable ActiveX Control Hosting</I> checkbox =
as=20
      shown here:</P>
      <P><IMG height=3D387 alt=3D" [AppWizard - 22K] "=20

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -