📄 samples.txt
字号:
GRAVTEST.MAK......The project file for this sample application.
GRAVTEST.FRM......Form used for user input.
GRAVTEST.BAS......A standard module.
TO RUN:
From the Visual Basic File menu, choose Open Project and
select the GRAVITY.MAK file, which is listed in the
\SAMPLES\OLESERV subdirectory of the main Visual Basic directory.
Press F5 or choose Start from the Run menu to run the application.
Once running, this project temporarily registers its classes in the
system registry. You can then open a second instance of Visual Basic.
In this second instance, from the Visual Basic File menu, choose Open
Project and select the GRAVTEST.MAK file, which is listed in the
\SAMPLES\OLESERV subdirectory of the main Visual Basic directory.
Then, you can run GRAVTEST.MAK (by pressing F5),
which is the controlling application that uses the classes,
methods, and properties defined in GRAVITY.MAK.
====================================================
9: Add-ins Sample Applications (SPY.MAK, ALIGN.MAK)
====================================================
Important: If you want to permanently register add-ins,
follow this procedure.
1. Make an executable file by choosing Make EXE File from
the File menu.
2. Run the .EXE file with the /REGSERVER command-line
argument. For example,
SPY16.EXE /REGSERVER
This will permanently register the add-in, and then
immediately close the add-in.
Spy Sample Application
----------------------
This program shows how to write a Visual Basic add-in in Visual Basic
to connect to the file control events that take place in Visual Basic.
This program, when installed and enabled in an instance of Visual Basic,
will display all file control events and all the parameters of the
events.
BACKGROUND:
Visual Basic has exposed some interfaces in its development
environment to allow object applications (OLE Automation servers)
to respond to certain events within Visual Basic and
to manipulate certain elements of the current project. These object
applications that are added to the Visual Basic development environment
are known as add-ins. Some of the Visual Basic events that the
add-in can respond to are events for loading, saving, deleting, and
renaming the files of a project. Visual Basic notifies
the add-in through events when a file or files
of a project are about to be loaded, saved, or renamed.
In addition, Visual Basic can now be used to create object applications
(OLE Automation servers). With this capability, Visual Basic
can be used to write an object application that can
be used as an add-in to the Visual Basic development environment.
FILES:
EVENTSPY.CLS......Class that is connected to the file event interface.
SPY.CLS...........Class that is connected to the spy menu item and
the add-in interface.
SPYSHOW.FRM.......Form that displays the event information.
MAIN.BAS..........Standard module of support procedures.
ABOUT.FRM.........Form that displays information about the example.
SPY.MAK...........The project file for the sample application.
TO RUN:
From the Visual Basic File menu, choose Open Project and
select the SPY.MAK file, which is listed in the
\SAMPLES\SPY subdirectory of the main Visual Basic directory.
You can then start the add-in by running the example.
(Press F5 or choose Start from the Run menu to run the application.)
Once the add-in is running, it is temporarily registered in the system
registry. If you want to permanently register the add-in, follow the
instructions at the beginning of Section 9: Add-ins Sample Applications.
Once the add-in is registered, you can then start another
instance of Visual Basic. From the Add-Ins menu, choose
Add-In Manager, and then select the check box next
to the Event Spy add-in. Once you do this, all file
events for the new instance of Visual Basic will be
displayed in the File Events form (SPYFORM.FRM).
Align Sample Application
------------------------
This application shows how to write a Visual Basic add-in using
Visual Basic. It demonstrates how to add a menu and menu items
to the Add-Ins menu in the Visual Basic development environment,
and manipulate properties of controls on a form. This program,
when installed in an instance of Visual Basic,
will align all selected controls on a form to each other.
BACKGROUND:
Visual Basic has exposed some interfaces in its development
environment to allow object applications to respond to certain
events within Visual Basic and to manipulate certain elements of the
current project. These object applications that are added to the
Visual Basic development environment are known as add-ins. Some of
the Visual Basic events that the add-in can respond to are events
caused by selecting a menu item in a menu that was added to the
Add-Ins menu by the add-in.
Also, the add-in can retrieve and change properties of the currently
enabled form and controls on the form. Using these capabilities,
this example will align all currently selected controls on a form
together. This alignment will be with the selected edge of the
currently selected controls.
In addition, Visual Basic can now be used to write
object applications. With this capability, Visual Basic
can be used to create an object application that can be used as
an add-in to the Visual Basic development environment.
FILES:
ALIGN.CLS.........Class that is connected to the add-in interface.
LEFTALGN.CLS......Class that is connected to the Left Align menu
item and aligns the left edges of the currently
selected controls.
RGHTALGN.CLS......Class that is connected to the Right Align menu
item and aligns the right edges of the currently
selected controls.
TOPALIGN.CLS......Class that is connected to the Top Align menu
item and aligns the top edges of the currently
selected controls.
BTTMALGN.CLS......Class that is connected to the Bottom Align menu
item and aligns the bottom edges of the currently
selected controls.
MAIN.BAS..........Standard module of support procedures.
ABOUT.FRM.........Form that displays information about the example.
ALIGN.MAK.........The project file for the sample application.
TO RUN:
From the Visual Basic File menu, choose Open Project and
select the ALIGN.MAK file, which is listed in the
\SAMPLES\ALIGN subdirectory of the main Visual Basic directory.
You can then start the add-in by running ALIGN.MAK.
(Press F5 or choose Start from the Run menu to run the application.)
Once the add-in is running, it is temporarily registered in the system
registry. If you want to permanently register the add-in, follow the
instructions at the beginning of Section 9: Add-ins Sample Applications.
Once the add-in is registered, you can then start another
instance of Visual Basic. From the Add-Ins menu, choose Add-In Manager,
and then select the check box next to the SimpleAlign add-in.
Once this is done, select the controls you want to align on a form,
and then choose the Align menu on the Add-Ins menu
to select the desired alignment. The add-in will then align
the selected edge of all the currently selected controls.
Note: You can't use the Align menu command if you have
selected a Line or Timer control, or any other control that
doesn't support position properties.
=================================
10: Data Form Designer (DFD.MAK)
=================================
This sample application uses the IDE extensibility in Visual Basic 4.0
to create a Data Form Designer (Wizard) capable of adding forms
to the current Visual Basic project.
This sample program illustrates how to create a powerful Visual Basic
add-in that performs a normally tedious task in a few easy steps.
It performs the following functions:
1. Creates and adds a new form to the current Visual Basic project.
2. Adds a label with the field name for each field.
3. Adds a bound control for each field (TextBox for
string, date, and numeric data; CheckBox for
Boolean; multiple-line TextBox for memo field;
and OLE container for binary data)
4. Adds command buttons to perform various data
access functions.
5. Adds code behind the command buttons and the
data control with liberal comments.
FILES:
DFD.FRM...........Main form.
DFD.FRX...........Binary data for the main form.
DFD.MAK...........Project file for the add-in.
DFDCLASS.CLS......Class module.
MODDFD.BAS........Support code.
Here is a step-by-step example of how to use the Data Form Designer.
1. Load Visual Basic 4.0.
2. From the File menu, choose Open Project, and select DFD.MAK
(in the \SAMPLES\DATAWIZ subdirectory of the main
Visual Basic directory).
3. From the File menu, choose Make EXE File, and save
it to the \VB directory.
4. Unload Visual Basic.
5. Run DFDxx.EXE (where xx=16 or 32)
This adds it to the Add-Ins section of the VB.INI file.
6. Run DFDxx.EXE /regserver
This registers the server permanently.
7. Load Visual Basic 4.0.
8. From the Add-Ins menu, choose Add-In Manager.
9. Select the check box next to the Data Form Designer add-in
(this makes it available), and then choose OK.
10. From the Add-Ins menu, choose Data Form Designer.
11. Enter a form name (1-8 characters, no spaces).
12. Select or enter a Connect string.
13. Open a database.
14. Select or enter a RecordSource.
15. Select the fields to include (choosing ">>" selects all fields).
16. Order fields with Drag/Drop in the list.
17. Select Build the Form.
18. Watch it build the form in your project.
19. Add another form or close the Data Form Designer.
20. Add a form load in your project for the newly
created form. Its name will be the name you entered
prefixed with "frm".
21. Run your application and execute the form load to see
how the new form works.
===========================================
11: IconWorks (ICONWRKS.EXE, ICONWRKS.HLP)
===========================================
The IconWorks sample application demonstrates how to create a
Help system for a Visual Basic application.
FILES:
ICONWRKS.EXE.......The executable file for IconWorks.
ICONWRKS.HLP.......The Help file for IconWorks.
ICONWRKS.HPJ.......Help project file.
ICONWRKS.RTF.......Source topic file for ICONWORKS.HLP.
*.BMP..............Bitmap source files.
*.SHG..............Hypergraphic source files.
TO RUN:
To view the finished Help file with the IconWorks
executable file, run ICONWRKS.EXE, which is located in the
\HC subdirectory of the main Visual Basic directory. To view
the contents of the source files, use Microsoft Word for Windows
to view ICONWRKS.RTF, Notepad or any other text editor to
view ICONWRKS.HPJ, and Paintbrush to view .BMP and
.SHG files.
Note: IconWorks will only run on 16-bit Windows operating systems.
==================================
12: Crystal Reports (CROCXSAM.MAK)
==================================
The Crystal Reports sample application demonstrates how to use the
Crystal Reports custom control to add report writing capabilities to your
application and enable your users to customize a report before they use
it.
FILES:
CROCXSAM.MAK.......The project file for this sample application.
FORM1.FRM..........The main form.
FORM2.FRM..........Printer options form.
FORM3.FRM..........Print to File settings form.
TO RUN:
From the Visual Basic File menu, choose Open Project and
select the CROCXSAM.MAK file, which is listed in the
\REPORT subdirectory of the main Visual Basic directory.
Press F5 or choose Start from the Run menu to run the application.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -