Microsoft KB Archive/58425

= Microsoft Knowledge Base =

BC 6.00/7.00 Example; Multiple Processes Talking in OS/2 Queue
Last reviewed: May 30, 1996

Article ID: Q58425

SUMMARY
A file (BCOS2QUE.EXE) is available in the Microsoft Software Library that provides an example of using OS/2 queues from compiled Basic. In this example, two compiled Basic processes running in two different OS/2 screen groups communicate with each other through a queue. The example uses the following MS OS/2 API calls:

DosCreateQueue DosOpenQueue DosReadQueue DosWriteQueue DosQueryQueue DosCloseQueue DosAllocShrSeg DosGetShrSeg

This information applies to Microsoft Basic Compiler versions 6.00 and 6.00b for MS OS/2, and to Microsoft Basic Professional Development System (PDS) versions 7.00 and 7.10 for MS OS/2. (This information does not apply to Microsoft QuickBasic, which supports only the MS-DOS operating system.)

You can find BCOS2QUE.EXE, a self-extracting file, on these services:

  Microsoft's World Wide Web site on the Internet On the www.microsoft.com home page, click the Support icon Click Knowledge Base, and select the product Enter kbfile BCOS2QUE.EXE, and click GO! Open the article, and click the button to download the file   Internet (anonymous FTP) ftp ftp.microsoft.com Change to the Softlib/Mslfiles folder Get BCOS2QUE.EXE   The Microsoft Network On the Edit menu, click Go To, and then click Other Location Type &quot;mssupport&quot; (without the quotation marks) Double-click the MS Software Library icon Find the appropriate product area Locate and Download BCOS2QUE.EXE   Microsoft Download Service (MSDL) Dial (206) 936-6735 to connect to MSDL Download BCOS2QUE.EXE 

For additional information about downloading, please see the following article in the Microsoft Knowledge Base:

ARTICLE-ID: Q119591 TITLE    : How to Obtain Microsoft Support Files from Online Services

MORE INFORMATION
The following files make up this example:

 Q1.BAS - A program that creates/reads to a Queue Q2.BAS - A program that opens/writes to a Queue QUEUE.BI - An include file used by Q1.BAS and Q2.BAS</li> UTIL.BAS - Basic routines to read/write shared memory</li>  README.Q - Text file describing how to compile, link, and run this example (as shown below). </li></ol>

The following are compile and LINK instructions:


 * 1) BC q1;
 * 2) BC q2;
 * 3) BC util /x;
 * 4) LINK q1 util;
 * 5) LINK q2 util;

The following are execution instructions:

<ol> Create two OS/2 protected mode sessions.</li>  Run Q1 in one session. The program performs the following sequence of steps: a. Create the Queue (DosCreateQueue). b. Allocate Shared Segment (DosAllocShrSeg). c. Query the Queue until an error or an item is entered (DosQueryQueue). d. Read the items out of the Queue (DosReadQueue). e. Close the Queue (DosCloseQueue). </li>  When Q1 is waiting for Queue information, start Q2 in the other MS OS/2 protected mode session. The program performs the following sequence of steps: a. Get the segment shared in Q1 (DosGetShrSeg). b. Open the Queue (DosOpenQueue). c. Write to the Queue (DosWriteQueue). d. Exit the program. </li></ol>