亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ch16.htm

?? Learning language of Visual C++6
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
</PRE>
<P>In CShowStringView::OnDraw(), change the code that calls GetColor() to call GetDocColor()
and then change the code that calls GetString() to call GetDocString(). Build the
project to check for any typing mistakes or forgotten changes. Although it may be
tempting to run ShowString now, it won't do what you expect until you make a few
more changes.</P>
<P>
<H3><A NAME="Heading5"></A>Showing the Window</H3>
<P>By default, Automation servers don't have a main window. Remember the little snippet
from CShowStringApp::InitInstance() in Listing 16.14.</P>
<P>
<H4>Listing 16.14&#160;&#160;ShowString.cpp--How the App Was Launched</H4>
<PRE>// Check to see if launched as OLE server
if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
{
     // Application was run with /Embedding or /Automation.  Don't show the
     //  main window in this case.
     return TRUE;
</PRE>
<PRE>}
</PRE>
<P>This code returns before showing the main window. Although you could remove this
test so that ShowString always shows its window, it's more common to add a ShowWindow()
method for the controller application to call. You'll also need to add a RefreshWindow()
method that updates the view after a variable is changed; ClassWizard makes it simple
to add these functions. Bring up ClassWizard, click the Automation tab, make sure
that CShowStringDoc is still the selected class, and then click Add Method. Fill
in the External name as <B>ShowWindow</B>. ClassWizard fills in the internal name
for you, and there's no need to change it. Choose void from the Return Type drop-down
list box. Figure 16.6 shows the dialog box after it's filled in.</P>
<P><A HREF="javascript:popUp('16uvc06.gif')"><B>FIG. 16.6</B></A><B> </B><I>ClassWizard
makes it simple to add a ShowWindow() method.</I></P>
<P>Click OK the dialog box, and ShowWindow() appears in the middle of the list of
properties, which turns out to be a list of properties and methods in alphabetical
order. The <I>C</I> next to the properties reminds you that these properties are
custom properties. The <I>M </I>next to the methods reminds you that these are methods.
With ShowWindow() highlighted, click Edit Code and then type the function, as shown
in Listing 16.15.</P>


<BLOCKQUOTE>
	<P>
<HR>
<B>See</B> &quot;Displaying the Current Value,&quot; <A HREF="../ch17/ch17.htm"><B>ch.
	17</B></A> 
<HR>


</BLOCKQUOTE>

<H4>Listing 16.15&#160;&#160;ShowStringDoc.cpp--CShowStringDoc::ShowWindow()</H4>
<PRE>void CShowStringDoc::ShowWindow()
{
    POSITION pos = GetFirstViewPosition();
    CView* pView = GetNextView(pos);
    if (pView != NULL)
    {
        CFrameWnd* pFrameWnd = pView-&gt;GetParentFrame();
        pFrameWnd-&gt;ActivateFrame(SW_SHOW);
        pFrameWnd = pFrameWnd-&gt;GetParentFrame();
        if (pFrameWnd != NULL)
            pFrameWnd-&gt;ActivateFrame(SW_SHOW);
    }
</PRE>
<PRE>}
</PRE>
<P>This code activates the view and asks for it to be shown. Bring up ClassWizard
again, click Add Method, and add RefreshWindow(), returning void. Click OK and then
Edit Code. The code for RefreshWindow(), shown in Listing 16.16, is even simpler.</P>
<P>
<H4>Listing 16.16&#160;&#160;ShowStringDoc.cpp--CShowStringDoc::RefreshWindow()</H4>
<PRE>void CShowStringDoc::RefreshWindow()
{
     UpdateAllViews(NULL);
     SetModifiedFlag();
</PRE>
<PRE>}
</PRE>
<P>This arranges for the view (now that it's active) and its parent frame to be redrawn.
Because a change to the document is almost certainly the reason for the redraw, this
is a handy place to put the call to SetModifiedFlag(); however, if you prefer, you
can put it in each Set function and the notification functions for the direct-access
properties. You'll add a call to RefreshWindow() to each of those functions now--for
example, SetHorizCenter():</P>
<P>
<PRE>void CShowStringDoc::SetHorizCenter(BOOL bNewValue)
{
     m_horizcenter = bNewValue;
     RefreshWindow();
}
</PRE>
<P>And OnColorChanged() looks like this:</P>
<P>
<PRE>void CShowStringDoc::OnColorChanged()
{
     RefreshWindow();
}
</PRE>
<P>Add the same RefreshWindow() call to SetVertCenter() and OnStringChanged(). Now
you're ready to build and test. Build the project and correct any typing errors.
Run ShowString as a standalone application to register it and to test your drawing
code. You can't change the string, color, or centering as you could with older versions
of ShowString because this version doesn't implement the Tools, Options menu item
and its dialog box. The controller application will do that for this version.</P>
<P>
<H2><A NAME="Heading6"></A>Building a Controller Application in Visual Basic</H2>
<P>This chapter has mentioned a controller application several times, and you may
have wondered where it will come from. You'll put it together in Visual Basic. Figure
16.7 shows the Visual Basic interface.</P>
<P><A HREF="javascript:popUp('16uvc07.gif')"><B>FIG. 16.7</B></A><B> </B><I>Visual
Basic makes Automation controller applications very quickly.</I></P>
<P>


<BLOCKQUOTE>
	<P>
<HR>
<strong>TIP:</strong> If you don't have Visual Basic but Visual C++ version 4.x or earlier,
	you can use DispTest, a watered-down version of Visual Basic that once came with
	Visual C++. It was never added to the Start menu, but you can run DISPTEST.EXE from
	the C:\MSDEV\BIN folder or from your old Visual C++ CD-ROM's \MSDEV\BIN folder. If
	you've written VBA macros in Excel and have a copy of Excel, you can use that, too.
	For testing OLE Automation servers, it doesn't matter which you choose. 
<HR>


</BLOCKQUOTE>

<P>To build a controller application for the ShowString Automation server, start
by running Visual Basic. Create and empty project by choosing File, New, and double-clicking
Standard EXE. In the window at the upper-right labeled Project1, click the View Code
button. Choose Form from the left drop-down list box in the new window that appears;
the Form_Load() subroutine is displayed. Enter the code in Listing 16.17 into that
subroutine.</P>
<P>
<H4>Listing 16.17&#160;&#160;Form1.frm--Visual Basic Code</H4>
<PRE>Private Sub Form_Load ()
   Set ShowTest = CreateObject(&quot;ShowString.Document&quot;)
   ShowTest.ShowWindow
   ShowTest.HorizCenter = False
   ShowTest.Color =
   ShowTest.String = &quot;Hello from VB&quot;
   Set ShowTest = Nothing
</PRE>
<PRE>End Sub
</PRE>
<P>Choose (General) from the left drop-down list box and then enter this line of
code:</P>
<P>
<PRE>Dim ShowTest As Object
</PRE>
<P>For those of you who don't read Visual Basic, this code will be easier to understand
if you execute it one line at a time. Choose Debug, Step Into to execute the first
line of code. Then repeatedly press F8 to move through the routine. (Wait after each
press until the cursor is back to normal.) The line in the general code sets up an
object called ShowTest. When the form is loaded (which is whenever you run this little
program), an instance of the ShowString object is created. The next line calls the
ShowWindow method to display the main window onscreen. Whenever the debugger pauses,
the line of code that will run next is highlighted in yellow. Also notice that there
is an arrow beside the highlighted line to further mark it. You will see something
like Figure 16.8 with the default ShowString behavior.</P>
<P><A HREF="javascript:popUp('16uvc08.gif')"><B>FIG. 16.8</B></A><B> </B><I>The ShowWindow
method displays the main ShowString window.</I></P>
<P>Press F8 again to run the line that turns off horizontal centering. Notice that
you don't call the function SetHorizCenter. You exposed HorizCenter as a property
of the OLE Automation server, and from Visual Basic you access it as a property.
The difference is that the C++ framework code calls SetHorizCenter to make the change,
rather than just make the change and then call a notification function to tell you
that it was changed. After this line executes, your screen will resemble Figure 16.9
because the SetHorizCenter method calls RefreshWindow() to immediately redraw the
screen.</P>
<P><A HREF="javascript:popUp('16uvc09.gif')"><B>FIG. 16.9</B></A><B> </B><I>The Visual
Basic program has turned off centering.</I></P>
<P>As you continue through this program, pressing F8 to move a step at a time, the
string will turn red and then change to Hello from<I> </I>VB. Notice that the change
to these directly exposed properties looks no different than the change to the Get/Set
method property, HorizCenter. When the program finishes, the window goes away. You've
successfully controlled your Automation server from Visual Basic.</P>
<P>
<H2><A NAME="Heading7"></A>Type Libraries and ActiveX Internals</H2>
<P>Many programmers are intimidated by ActiveX, and the last thing they want is to
know what's happening under the hood. There's nothing wrong with that attitude at
all. It's quite object-oriented, really, to trust the already written ActiveX framework
to handle the black magic of translating ShowTest.HorizCenter = False into a call
to CShowStringDoc::SetHorizCenter(). If you want to know how that &quot;magic&quot;
happens or what to do if it doesn't, you need to add one more piece to the puzzle.
You've already seen the dispatch map for ShowString, but you haven't seen the <I>type
library</I>. It's not meant for humans to read, but it is for ActiveX and the Registry.
It's generated for you as part of a normal build from your Object Definition Language
(ODL) file. This file was generated by AppWizard and is maintained by ClassWizard.</P>
<P>Perhaps you've noticed, as you built this application, a new entry in the ClassView
pane. Figure 16.10 shows this entry expanded--it contains all the properties and
methods exposed in the IShowString interface of your Automation server. If you right-click
IShowString in this list, you can use the shortcut menu to add methods or properties.
If you double-click any properties or methods, the .ODL file is opened for you to
view. Listing 16.18 shows ShowString.odl.</P>
<P><A HREF="javascript:popUp('16uvc10.gif')"><B>FIG. 16.10</B></A><B> </B><I>Automation
servers have an entry in the ClassView for each of their interfaces.</I></P>
<P>
<H4>Listing 16.18&#160;&#160;ShowString.odl--ShowString Type Library</H4>
<PRE>// ShowString.odl : type library source for ShowString.exe
// This file will be processed by the MIDL compiler to produce the
// type library (ShowString.tlb).
[ uuid(61C76C06-70EA-11D0-9AFF-0080C81A397C), version(1.0) ]
library ShowString
{
     importlib(&quot;stdole32.tlb&quot;);
     //  Primary dispatch interface for CShowStringDoc
     [ uuid(61C76C07-70EA-11D0-9AFF-0080C81A397C) ]
     dispinterface IShowString
     {
          properties:
               // NOTE - ClassWizard will maintain property information here.
               //    Use extreme caution when editing this section.
               //{{AFX_ODL_PROP(CShowStringDoc)
               [id(1)] BSTR String;
               [id(2)] short Color;
               [id(3)] boolean HorizCenter;
               [id(4)] boolean VertCenter;
               //}}AFX_ODL_PROP
          methods:
               // NOTE - ClassWizard will maintain method information here.
               //    Use extreme caution when editing this section.
               //{{AFX_ODL_METHOD(CShowStringDoc)
               [id(5)] void ShowWindow();
               [id(6)] void RefreshWindow();
               //}}AFX_ODL_METHOD
     };
     //  Class information for CShowStringDoc
     [ uuid(61C76C05-70EA-11D0-9AFF-0080C81A397C) ]
     coclass Document
     {
          [default] dispinterface IShowString;
     };
     //{{AFX_APPEND_ODL}}
     //}}AFX_APPEND_ODL}}
</PRE>
<PRE>};
</PRE>
<P>This explains why Visual Basic just thought of all four properties as properties;
that's how they're listed in this .ODL file. The two methods are here, too, in the
methods section. You passed &quot;ShowString.Document&quot; to CreateObject() because
there is a coclass Document section here. It points to a dispatch interface (dispinterface)
called IShowString. Here's the interface map from ShowStringDoc.cpp:</P>
<P>
<PRE>BEGIN_INTERFACE_MAP(CShowStringDoc, CDocument)
     INTERFACE_PART(CShowStringDoc, IID_IShowString, Dispatch)
END_INTERFACE_MAP()
</PRE>
<P>A call to CreateObject(&quot;ShowString.Document&quot;) leads to the coclass section
of the .ODL file, which points to IShowString. The interface map points from IShowString
to CShowStringDoc, which has a dispatch map that connects the properties and methods
in the outside world to C++ code. You can see that editing any of these sections
by hand could have disastrous results. Trust the wizards to do this for you.</P>
<P>In this chapter, you built an Automation server and controlled it from Visual
Basic. Automation servers are far more powerful than older ways of application interaction,
but your server doesn't have any user interaction. If the Visual Basic program wanted
to enable users to choose the color, that would have to be built into the Visual
Basic program. The next logical step is to allow the little embedded object to react
to user events such as clicks and drags and to report to the controller program what
has happened. That's what ActiveX controls do, as you'll see in the next chapter.</P>
<H1></H1>
<CENTER>
<P>
<HR>
<A HREF="../ch15/ch15.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"
ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch17/ch17.htm"><IMG
SRC="../button/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"
BORDER="0"></A><A HREF="../index.htm"><IMG SRC="../button/contents.gif" WIDTH="128"
HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> <BR>
</P>

<P>&#169; <A HREF="../copy.htm">Copyright</A>, Macmillan Computer Publishing. All
rights reserved.
</CENTER>


</BODY>

</HTML>

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
视频一区二区中文字幕| 国产精品久久久久久久久动漫 | 91美女在线观看| 欧美国产视频在线| 成人黄色国产精品网站大全在线免费观看| 久久精品免费在线观看| 成人福利在线看| 一区二区三区在线视频观看| 欧美乱妇15p| 久99久精品视频免费观看| 久久久精品天堂| 97精品国产露脸对白| 亚洲成人资源网| 欧美大肚乱孕交hd孕妇| 成人免费视频一区| 一区二区三区中文免费| 日韩色在线观看| 成人动漫中文字幕| 亚洲一区免费观看| 精品久久久三级丝袜| av一区二区三区在线| 亚洲妇女屁股眼交7| 精品动漫一区二区三区在线观看| 国产盗摄一区二区三区| 亚洲一区二区三区视频在线播放| 欧美一区二区人人喊爽| www.亚洲国产| 喷白浆一区二区| 国产精品电影院| 91精品国产91久久综合桃花| 成人网男人的天堂| 秋霞电影一区二区| 亚洲视频 欧洲视频| 777奇米四色成人影色区| 国产成人午夜精品影院观看视频 | 亚洲精品一区在线观看| 色综合久久久网| 免费国产亚洲视频| 亚洲激情五月婷婷| 久久一留热品黄| 欧美三级日韩三级| 国产成人在线影院| 日本网站在线观看一区二区三区 | 亚洲资源在线观看| 国产网站一区二区| 日韩亚洲欧美在线观看| 日本高清不卡aⅴ免费网站| 韩国精品在线观看| 免费日韩伦理电影| 亚洲国产精品天堂| 综合分类小说区另类春色亚洲小说欧美| 精品裸体舞一区二区三区| 91福利资源站| 99麻豆久久久国产精品免费| 韩国精品主播一区二区在线观看 | 欧美性受极品xxxx喷水| 成人av电影在线网| 国产精品一区二区在线播放 | 精品一区二区三区免费视频| 亚洲影院久久精品| 亚洲精品乱码久久久久久日本蜜臀| 久久久99精品久久| 亚洲精品在线电影| 日韩欧美三级在线| 欧美一级片在线| 欧美理论电影在线| 欧美日韩国产在线播放网站| 色悠悠久久综合| 99精品久久免费看蜜臀剧情介绍| 国产精品12区| 国产综合色视频| 国产一区二区三区最好精华液| 肉肉av福利一精品导航| 视频一区在线播放| 天天综合天天做天天综合| 亚洲一区二区3| 亚洲成人精品在线观看| 偷拍一区二区三区四区| 亚洲成人黄色影院| 午夜久久电影网| 免费观看成人鲁鲁鲁鲁鲁视频| 天天综合网 天天综合色| 婷婷丁香久久五月婷婷| 日韩国产欧美在线播放| 美国av一区二区| 久久99最新地址| 老司机精品视频在线| 国产一本一道久久香蕉| 国产精品1024| 99久久精品一区| 在线观看日韩国产| 欧美日韩一级大片网址| 日韩欧美三级在线| 国产亚洲人成网站| 日韩理论片一区二区| 亚洲福利一区二区| 久久er99精品| av一二三不卡影片| 欧美日韩久久久| 日韩欧美123| 中文字幕欧美日本乱码一线二线| 一区精品在线播放| 天堂一区二区在线| 国产一区二区免费看| 白白色 亚洲乱淫| 欧美日韩激情在线| 精品国产凹凸成av人导航| 国产精品久久久久久久久免费丝袜| 免费成人在线播放| 成人手机在线视频| 欧美日韩国产小视频| 久久久久久久综合| 亚洲综合丁香婷婷六月香| 久久精品国产免费看久久精品| 国产精品白丝jk黑袜喷水| 91福利国产精品| 久久中文字幕电影| 亚洲一级二级三级在线免费观看| 久久99国产精品久久99| 丁香啪啪综合成人亚洲小说| 欧美三日本三级三级在线播放| 欧美α欧美αv大片| 亚洲欧美日韩一区二区| 国内精品国产成人国产三级粉色 | 91成人在线精品| xvideos.蜜桃一区二区| 亚洲一区二区黄色| 岛国精品一区二区| 日韩视频在线你懂得| 亚洲激情av在线| 国产高清不卡二三区| 欧美裸体bbwbbwbbw| 最近中文字幕一区二区三区| 日本欧美韩国一区三区| 一道本成人在线| 欧美经典一区二区| 美女免费视频一区二区| 欧美亚洲一区二区在线观看| 国产欧美日韩综合| 日韩av一区二区三区| 欧美中文字幕一二三区视频| 国产精品私人影院| 国产精品白丝av| 欧美岛国在线观看| 亚洲成人一区二区在线观看| 91网站最新地址| 国产精品成人一区二区三区夜夜夜| 久久99久久99小草精品免视看| 欧美日韩在线不卡| 亚洲视频图片小说| 不卡影院免费观看| 国产精品视频观看| 精品一区二区久久| 欧美电视剧免费全集观看| 调教+趴+乳夹+国产+精品| 欧美日韩在线三区| 一区二区三区波多野结衣在线观看| caoporm超碰国产精品| 中文字幕欧美日韩一区| 国产成人免费视频网站 | 69p69国产精品| 亚洲午夜激情网页| 欧美日韩中文字幕一区二区| 一区二区高清免费观看影视大全| 99久久精品国产导航| 国产精品久久久久永久免费观看 | 91精品黄色片免费大全| 三级久久三级久久久| 欧美日韩国产在线观看| 久草在线在线精品观看| 日韩精品资源二区在线| 日韩av成人高清| 日韩一区二区三区电影 | 亚洲第一电影网| 欧美绝品在线观看成人午夜影视| 亚洲电影一级片| 91精品国产一区二区三区蜜臀| 日本免费新一区视频| 精品国产凹凸成av人导航| 国产精品69久久久久水密桃| 日本一区二区电影| 色哟哟在线观看一区二区三区| 一区二区三区在线观看欧美| 欧美久久久久久蜜桃| 免费成人在线观看视频| 久久久精品免费免费| 成人黄色在线网站| 亚洲精品成a人| 欧美一级欧美一级在线播放| 国产一区美女在线| 最新欧美精品一区二区三区| 91黄色免费看| 美国三级日本三级久久99| 久久久精品中文字幕麻豆发布| 99视频精品在线| 三级影片在线观看欧美日韩一区二区 | 欧美人xxxx| 国产乱人伦偷精品视频不卡| 亚洲乱码国产乱码精品精98午夜| 538prom精品视频线放|