📄 vcg16.htm
字号:
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
The Win32 track bar control.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
mscrls_updown32
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
The Win32 up-down control.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
SCROLLBAR
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
The standard scrollbar control.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
STATIC
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
The standard static control.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
SysAnimate32
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
The Win32 animation control.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
SysHeader32
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
The Win32 header control.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
SysListView32
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
The Win32 list view control.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
SysTabControl32
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
The Win32 tab control.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
SysTreeView32
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
The Win32 tree view control.</FONT>
</TABLE></CENTER><BR>
<A NAME="E70E82"></A>
<H5 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>The Edit Names Dialog Box</B></FONT></CENTER></H5>
<BR>
<P>To access the Edit Names dialog box, shown in Figure 16.4, click the Edit Names button in ControlWizard's Step 2 of 2 dialog box. It lets you define a number of names associated with each of the controls in your project.
<BR>
<P><B><A HREF="16vcg04.gif" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/16vcg04.gif">Figure 16.4. ControlWizard's Edit Names dialog box.</A></B>
<BR>
<P>The following names and attributes may be changed:
<BR>
<UL>
<LI>Short Name: The short name for this control, which is usually the same as the control's project name. If your control's project name doesn't make a clear name for the control, you should specify a new short name.
<BR>
<BR>
</UL>
<P>For the control itself, the following names may be specified:
<BR>
<UL>
<LI>Class Name: The name of the control's main class.
<BR>
<BR>
<LI>Header File: The filename of the main header file.
<BR>
<BR>
<LI>Type Name: The name that will appear in the Insert Object dialog box in the container application at design time.
<BR>
<BR>
<LI>Implementation File: The name of the main source file.
<BR>
<BR>
<LI>Type ID: The string that an OLE control registers in the registry when it's applied to a project. This string is then used by container applications to create instances of the OLE control.
<BR>
<BR>
</UL>
<P>For the control's property page, the following may be specified:
<BR>
<UL>
<LI>Class Name: The name of the control's property page class.
<BR>
<BR>
<LI>Header File: The filename of the property page header file.
<BR>
<BR>
<LI>Type Name: The name that will appear in the Insert Object dialog box in the container application at design time. Rarely used by anyone.
<BR>
<BR>
<LI>Implementation File: The name of the property page source file.
<BR>
<BR>
<LI>Type ID: The string that an OLE control registers in the registry when it's applied to a project. This string is then used by container applications to create instances of the OLE control's property page.
<BR>
<BR>
</UL>
<BR>
<A NAME="E70E83"></A>
<H5 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Generating Your OLE Control</B></FONT></CENTER></H5>
<BR>
<P>After you've defined your new OLE control, you can click the Finish button in ControlWizard's Step 2 of 2 dialog box. When you click Finish, the New Product Information dialog box, shown in Figure 16.5, appears. This dialog shows the various options, names, and configurations that you selected in the OLE control creation stage.
<BR>
<P><B><A HREF="16vcg05.gif" tppabs="http://202.113.16.101/%7eeb%7e/Database%20Developer's%20Guide%20with%20Visual%20C++%204,%20Second%20Edition/16vcg05.gif">Figure 16.5. ControlWizard's New Product Information dialog box.</A></B>
<BR>
<P>Review this dialog box and, if all is in order, click OK. Visual C++ 4 will then open the new control in Developer Studio.
<BR>
<P>Sometimes you'll want to create both 16-bit and 32-bit versions of your OLE control. To create a 16-bit version of your control, you must use Visual C++ 1.5x and its 16-bit OLE Control Development Kit. This might prove to be difficult, and I don't recommend it unless you have no alternative and must create 16-bit versions of your OLE controls. If you try to use Visual C++ 4 to create a 16-bit control, you must make sure that the control's project name is no more than four characters long, because the project's filenames must be short under Visual C++ 1.5x. You also need to create a new .MAK file for the control, a nontrivial task.
<BR>
<BR>
<A NAME="E69E213"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Register/Unregister Control</B></FONT></CENTER></H4>
<BR>
<P>Register Control and Unregister Control are two separate menu options on the Tools menu in versions of Visual C++ prior to 4. (If you don't have an Unregister Control option, you can add it to your Tools menu using the Customize option and the REGSVR32 program.) However, both options call the registration program (REGSVR.EXE for Windows 3.x and REGSVR32.EXE for Windows NT and Windows 95) that is found in Visual C++'s \MSDEV\BIN directory. Visual C++ 4's controls automatically register themselves when created (as part of the project build process), but you can have a Register Control menu option on your Visual C++ 4 Tools menu too.
<BR>
<P>The REGSVR32 program takes as an argument the name of the control to be registered or unregistered. This name generally is the OLE control's DLL filename with the file extension. REGSVR32 also takes the following optional parameters, which aren't case-specific:
<BR>
<UL>
<LI>The /s option tells REGSVR32 not to generate normal output. This option is similar to the Linker's /NOLOGO option.
<BR>
<BR>
<LI>The /c option tells REGSVR32 to run in console mode.
<BR>
<BR>
<LI>The /v option tells REGSVR32 that it's running under Visual C++.
<BR>
<BR>
<LI>The /u option tells REGSVR to unregister the control rather than register it.
<BR>
<BR>
</UL>
<P>REGSVR32 is both small and efficient. It has no features or options other than those just described. REGSVR32 can't be redistributed. Other developers who are using your controls must use their own tools to register and install controls. The source for REGSVR32 is available on the Visual C++ CD in the directory \MSDEV\SAMPLES\MFC\CONTROLS\REGSVR.
<BR>
<BR>
<A NAME="E69E214"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Test Container</B></FONT></CENTER></H4>
<BR>
<P>Test Container (TSTCON16 or TSTCON32, depending on the version of Windows to which you're targeting your OLE controls) is a very useful utility that lets you embed OLE controls and test their functionality. Test Container doesn't have all the usability of a full-fledged application, but it does let you test most of the aspects of your control. However, you still must test your control in its final environment, such as in an Access form.
<BR>
<P>Test Container runs externally to Visual C++ and therefore doesn't come in a debugging version. Generally, when you debug your control, you load it into Visual C++ and then start OLE Control Test Container from Visual C++'s Tools menu.
<BR>
<P>When Test Container is loaded and running, the first thing you'll do is insert an OLE control. After you insert a control into Test Container's document space, you can work with the control's interface. (You'll need to test both the user interface and the OLE control's interface with the container.)
<BR>
<P>Test Container's user interface is both a menu bar and a toolbar. The menu bar offers the options described in Table 16.2.
<BR>
<BR>
<P ALIGN=CENTER>
<CENTER>
<FONT COLOR="#000080"><B>Table 16.2. Test Container's menu options.</B></FONT></CENTER>
<BR>
<CENTER><TABLE BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 CELLPADDING=3 >
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
<I>Menu</I>
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
<I>Option</I>
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
<I>Description</I>
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
File
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Save to Stream
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Saves the currently selected OLE control to a stream. A stream can hold one or more OLE controls, and an OLE control can be saved to the stream more than once. After an OLE control has been saved to a stream, the Save to Substorage selection is disabled until the stream has been cleared.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Save to Substorage
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Saves the currently selected OLE control to substorage. Substorage can hold one or more OLE controls, and an OLE control can be saved to substorage more than once. After an OLE control has been saved to substorage, the Save to Stream selection is disabled until substorage has been cleared.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Load
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Loads the currently saved stream or substorage.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Save Property Set
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Saves the properties of the currently selected OLE control to a document file.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Load Property Set
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Creates a new OLE control and initializes it from the previously saved document file.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Register Controls
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Registers a new OLE control. Performs the same function as Visual C++'s Tools | Register Control menu option.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Exit
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Ends the Test Container program.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Edit
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Insert OLE Control...
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Opens the Insert OLE control dialog box and lets you select a new control to be added to Test Container's document space.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Delete
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Deletes the currently selected OLE control.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Delete All
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Deletes all the OLE controls that are in Test Container's document.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Set Ambient Properties
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
The Ambient Properties dialog box sets the container properties that affect all OLE controls. Properties such as UserMode, BackColor, Font, and so on can be set in this dialog box.
</FONT>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -