LONG: VB Pro 3.0 SAMPLES.TXT: Descriptions of Sample ProgramsLast reviewed: July 19, 1995Article ID: Q107990 |
The information in this article applies to:
- Professional Edition of Microsoft Visual Basic for Windows, version 3.0
SUMMARYThe following article contains the complete contents of the SAMPLES.TXT file distributed with the Professional Edition of Visual Basic version 3.0 for Windows. SAMPLES.TXT describes the sample programs shipped with this product.
MORE INFORMATION
SAMPLES.TXT Samples Notes for Microsoft (R) Visual Basic (R) Professional Edition Version 3.00 (C) Copyright Microsoft Corporation, 1993 ContentsSample Description ------ ----------- 1 MAPI 2 Multimedia 3 Outline 4 Pen 5 PicClip 6 ODBC 7 Communications 1: MAPI SampleProgram example using the MSMAPI.VBX controls, MapiMessages and MapiSession controls. NOTE: To run this sample, you need a MAPI-compliant messaging system such as the one contained in Microsoft Windows for Workgroups.BRIEF DESCRIPTION: This sample program illustrates the use of the MAPI controls by sending and receiving electronic mail. BACKGROUND: The MapiSession control establishes a MAPI session and signs off from a MAPI session. The MapiMessages control allows you to perform a variety of messaging systems functions after a messaging session has been established. These functions include accessing, downloading, and sending messages, displaying the details and address book dialog boxes, accessing data attachments, resolving recipient names during addressing, and performing compose, reply, reply-all, forward, and deleting actions on messages. FILES: MAILLST.FRM.......Form for displaying the list of mail messages. MAILLST.FRX.......The binary portion of the mail messages form. MAILOPTF.FRM......Form for setting options. MAILSUP.BAS.......Module of support routines for the example. MSGVIEW.FRM.......Form in which a viewed message is displayed. MSGVIEW.FRX.......The binary portion of the viewed messages form. NEWMSG.FRM........Form for creating a new message. VBMAIL.FRM........The main form. VBMAIL.FRX........The binary portion of the main form. VBMAIL.MAK........The MAKE file for the project.TO RUN: After starting the Visual Basic environment (VB.EXE), you can load files in this sample program by choosing Open Project from the File menu and selecting the VBMAIL.MAK file.
2: Multimedia SampleThis sample program illustrates the use of some of the device types supported by the Media Control Interface (MCI). The four device types used in this program are:
Device Type Description MMMovie Plays Multimedia movie files (*.MMM). CDAudio Plays audio discs from the CD-ROM drive. Sequencer Plays MIDI sequencer sound files (*.MID). WaveAudio Plays digitized waveform sound files (*.WAV).HARDWARE REQUIREMENTS: In order to access a CD-ROM drive or a sound card, the hardware, along with any supporting device drivers, should be installed and configured for the machine. The following table lists the hardware required for the MCI device types used in this program:
Device Type Hardware MMMovie No extra hardware. *See software requirements. CDAudio CD-ROM drive. Sequencer Sound card (e.g., Sound Blaster Pro) WaveAudio Sound card.SOFTWARE REQUIREMENTS: In order to run the MCI application, Microsoft Windows with Multimedia Extensions 1.0, or Windows with Multimedia must be installed. The Multimedia Extensions include device drivers for the different types of MCI devices. To access a specific MCI device type, the corresponding MCI device driver must be installed. The following table lists the device drivers required for the MCI device types used in this program:
Device Type Device Driver MMMovie MCIMMP.DRV *See note below. CDAudio MCICDA.DRV Sequencer MCISEQ.DRV WaveAudio MCIWAVE.DRVThe [mci] section of the SYSTEM.INI file contains a list of the installed MCI device types. This is what your file would look like if all 4 of the above device types were installed: [mci] CDAudio=mcicda.drv WaveAudio=mciwave.drv Sequencer=mciseq.drv MMMovie=mcimmp.drv BACKGROUND: The MCI control provides a high-level interface for using multimedia devices. Using the property settings of a control, you can determine the settings and the actions of a device. The MCI control is also smart enough to know what actions are relevant for the current state of a device. For example, if you click a "Pause" button while playing a movie, the "Play" button is automatically re-enabled. MMMovie NOTE: If you are unable to run an animation movie (*.MMM file), make sure the MCIMMP.DRV and MMP.DLL files are installed on your machine. To install the animation driver from Windows 3.1, run the "Drivers" applet from the Control Panel, insert Disk 1 of the Professional Edition. Select "Unlisted Driver," and accept "A:\" as the directory. You will then be ready to use the animation features of the MCI control. FILES: ABOUTBOX.FRM.......The dialog box for the "About Box." ABOUTBOX.FRX.......The binary portion of the "About Box" form. ANIMATE.FRM........Form for playing Multimedia Movie files. CD.FRM.............The form for playing compact disc audio. CD.FRX.............The binary portion of the compact disc form. GLOBAL.BAS.........Global data types and declarations. MCITEST.BAS........Global Subs and Functions. MCITEST.FRM........The main form. MCITEST.FRX........The binary portion of the main form. MCITEST.MAK........The make file for the project. MCITEST.MID........Sample MIDI sequencer file. MCITEST.MMM........Sample Multimedia Movie file. MCITEST.WAV........Sample waveform file. OPENDLG.FRM........Form for holding the common dialog control. WAVE.FRM...........Form for playing waveform and MIDI files.TO RUN: In the Visual Basic environment (VB.EXE), you can load the files in this sample program by choosing Open Project from the File menu, and selecting the MCITEST.MAK file. Two additional files appear in the Project Window: MCI.VBX............MCI control. CMDIALOG.VBX.......Common Dialog control.
3: Outline SampleProgram example using the MSOUTLIN.VBX control.BRIEF DESCRIPTION: This sample program illustrates the use of the Outline control with an address book database application. BACKGROUND: The outline control allows users to graphically present hierarchically structured data in a variety of different ways. FILES: PHONE.FRM.........The main form. PHONE.FRX.........Binary data for the main form. PHONE.MAK.........The MAKE file for the project. PHONE.MDB.........Database file. PHONE.LDB.........Database file. FIRSTTAB.BMP......Bitmap for the project. LASTTAB.BMP.......Bitmap for the project. MIDTAB.BMP........Bitmap for the project.TO RUN: After starting the Visual Basic environment (VB.EXE), you can load files in this sample program by choosing Open Project from the File menu and select the PHONE.MAK file.
4: Pen SampleNOTE: To run this sample you must have Windows for Pen Computing, or install the PENWIN.DLL file. See below.BRIEF DESCRIPTION of PEN SAMPLE PROGRAM: This sample program illustrates many uses of the Pen controls:
* the new On-Screen Keyboard control * inking and displaying bitmaps on the new InkOnBitmap control * handwriting recognition in both delayed and non-delayed mode * recognition of gestures * transfer of ink data between controls * manipulation of the Recognition Context data structure * and more.The file PENAPI.TXT contains function and constant declarations for the entire set of Windows for Pen Computing API. FILES: DELAY.FRM.........Form for demonstrating Delayed Recognition. DELAY.FRX.........The binary for DELAY.FRM. EDITSUBF.FRM......Support Form for Gesture demonstration. GESTFRM.FRM.......Form for demonstrating Custom Gestures. INKFRM.FRM........Form for showing transfer of Ink data. IOBFRM.FRM........Form demonstrating the Ink On Bitmap control. IOBFRM.FRX........The binary for IOBFRM.FRM. KEYBRD.FRM........Form for the On-Screen Keyboard Button demo. KEYBRD.FRX........The binary for KEYBRD.FRM. PENAPI.TXT........Pen function declarations and constants. PENMAIN.FRM.......Main form. PENMAIN.FRX.......The binary for MAIN.FRM. PENSMPL.MAK.......The MAKE file for the project. RCFRM.FRM.........Form demonstrating the Recognition Context. GRAFPAPR.BMP......Bitmap for creating graph paper effect. RULEPAPR.BMP......Bitmap for creating ruled paper effect. SKBFACE.BMP.......Bitmap of default keyboard on SKB Button. TRANSFRM.FRM......Form for demonstrating transfer of ink data.TO RUN: After starting the Visual Basic environment (VB.EXE), you can load files in this sample program by choosing Open Project from the File menu and select the PENSMPL.MAK file. Installing PENWIN.DLL: This procedure will result in a system that will let you run applications that contain Visual Basic BEdit, HEdit, InkOnBitmap, and SKB Button controls and call the Windows for Pen Computing APIs. You will not be able to perform handwriting recognition or draw ink on the screen. Microsoft Windows 3.1 is required. SYSTEM.INI Changes The following items must be added or changed in your SYSTEM.INI file so that the pen extensions will work. NOTE: Back up your old SYSTEM.INI file before proceeding.
5: PicClip SampleProgram example using the PICCLIP.VBX control. BRIEF DESCRIPTION: This sample program illustrates one of the many possible uses of the Picture Clipping control. BACKGROUND: This sample application uses the PicClip control to spin a top. FILES: INFOFORM.FRM......The information form. INFOFORM.FRX......The binary data for the information form. REDTOP.FRM........The main form. REDTOP.FRX........The binary data for the main form. REDTOP.MAK........The MAKE file for the project.TO RUN: After starting the Visual Basic environment (VB.EXE), you can load files in this sample program by choosing Open Project from the File menu and selecting the REDTOP.MAK file.
6: ODBCProgram example using ODBC and the VT (Virtual Table) object layer. NOTE: To access ODBC data sources with this sample, you must first install ODBC using the ODBC setup program provided with Visual Basic Professional Edition.BRIEF DESCRIPTION: This sample program illustrates various programming techniques used to access data through the VT layer built into the Visual Basic Professional Edition. It behaves like a general purpose database utility capable of the following functions:
1. Table Creation 2. Table Modification (adding and deleting fields and indexes) 3. Data Browsing/Modifying one record at a time using a dynaset or a table. 4. Data Browsing via the Grid control (non-updatable) 5. Data Browsing/Modifying via the new Data Control 6. Data Export to Tab Delimited text file 7. Direct SQL Statement execution for any SQL supported functions such as Insert, Update, Delete, Drop, Create, Dump, etc. 8. AdHoc Query tool that helps users unfamiliar with SQL create complex queries with where clauses, joins, order by and group by expressions while limiting output to selected columns 9. Transaction Processing 10. Copying table structures and data to same or different server 11. Support of Microsoft Access, Dbase 3, Dbase 4, FoxPro 2.0, Paradox 3.x, Btrieve, SQL and Oracle data, both DDL and DML.The code contains comments to help explain the use of the various methods in the data access layer. Code and forms may be copied from this application to other applications with minimal modification. ODBC BACKGROUND: ODBC (Open Database Connectivity) is a standard adopted by multiple vendors designed to enable users to connect to any data source with a single application. This is achieved through a layered approach including:
FILES: ABOUTBOX.FRM......Standard "About box" for the application. ABOUTBOX.FRX......Icon for the "About Box". ADDFIELD.FRM......Form to add fields to Tables. CPYSTRU.FRM.......Form to copy Table structures. DATABOX.FRM.......General purpose list form. DYNAGRID.FRM......Form used to display data in a Grid control. DYNAGRID.FRX......Icon for DYNAGRID.FRM. DYNASET.FRM.......Form to display data in single record mode. DYNASET.FRX.......Icon for DYNASET.FRM FIND.FRM..........Form used to find records in a Dynaset. INDEXADD.FRM......Form used to add indexes to Tables. JOIN.FRM..........Form used to add Joins to the Query Builder. OPENDB.FRM........Form used to open a database. QUERY.FRM.........Form used to build Queries. QUERY.FRX.........Icon for QUERY.FRM. REPLACE.FRM.......Form to perform global replaces on a Table. REPLACE.FRX.......Icon for REPLACE.FRM. SEEK.FRM..........Form used to get input for Seek function on Table form. SQL.FRM...........Form to enter and execute SQL statements. SQL.FRX...........Icon for SQL.FRM. TABLES.FRM........Form used to display table lists. TABLES.FRX........Icon for TABLES.FRM. TABLEOBJ.FRM......Form used to display data in Table object TABLEOBJ.FRX......Icon for TABLEOBJ.FRM TBLSTRU.FRM.......Form to display and modify table structures. VDMDI.FRM.........Main MDI form for the application. VDMDI.FRX.........Icon for VDMDI.FRM. VISDATA.BAS.......Support functions for the application. VISDATA.ICO.......Icon for the applicaiton. VISDATA.MAK.......Make file for applicaiton. ZOOM.FRM..........Form to zoom in on character data in the dynaset forms.TO RUN: After starting the Visual Basic environment (VB.EXE), you can load files in this sample program by choosing Open Project from the File menu and selecting the VISDATA.MAK file in the SAMPLES\VISDATA directory. To open a local database, choose the type of database and a file open common dialog will be provided with the file type set to the requested data file type. If you choose ODBC from the File/Open menu, the next dialog you will see is the Open Database form. Because you probably have no servers entered, you will need to enter a name for an existing SQL server on your network. If you already know the user ID and password, you can add them as well. The Database name is optional. Once you have entered this data, select 'Okay' and you should be able to log on to the server. You may get some more dialogs in the process. Answer any questions you can and ask the SQL administrator for help if you run into problems or don't know some of the parameters. Once a database is open, double-click a table name to open the table in the selected mode (Single Record or Table View). Use the Query Builder to create dynasets with selected data from one or more tables at a time. If "Use Data Control" or "Use Grid" is chosen, a dynaset will be created. However, the following objects will be created only under the following circumstances when the "No Data Control" option is selected:
Data Type Feature Chosen Object Type Created Microsoft Access Table Open Table Microsoft Access Query Open Dynaset Microsoft Access Execute SQL Dynaset ISAM Table Open Table ISAM Execute SQL Dynaset ODBC Any DynasetThe table is always updatable and the dynaset will be updatable in most cases except on ODBC with no unique index, certain multiple table joins, and other SQL select statements such as count(*), max(), and so on.
7: Communications Samples
VBTERM SampleVBTERM is a terminal emulation program example using MSCOMM.VBX.BRIEF DESCRIPTION: This sample program illustrates how to use the communications control with a serial port. BACKGROUND: MSCOMM.VBX allows you to open a serial port, change its settings, send and receive data through the port, and monitor and set many of the different data lines. It's dual-method access allows for both polling and event driven communications. FILES: CANSEND.FRM.......Dialog box used during file transfer. TERMSET.FRM.......Form used to change the serial port settings. TERMSET.FRX.......Binary data for TERMSET.FRM. VBTERM.FRM........The main form. VBTERM.FRX........Binary data for VBTERM.FRM. VBTERM.GLO........Global declarations. VBTERM.MAK........The MAKE file for the project.TO RUN: After starting the Visual Basic environment (VB.EXE), you can load files in this sample program by choosing Open Project from the File menu and select the VBTERM.MAK file.
Dialer SampleDIALER is a program example demonstrating how to dial out using MSCOMM.VBX with a modem.FILES: DIALER.FRM........The main form. DIALER.MAK........The MAKE file for the project.TO RUN: After starting the Visual Basic environment (VB.EXE), you can load files in this sample program by choosing Open Project from the File menu and select the DIALER.MAK file.
|
Additional reference words: 3.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |