Microsoft KB Archive/39192

COBOL 3.0 Can Call Mouse in MS OS/2 Protected Mode

PSS ID Number: Q39192 Article last modified on 04-20-1993

3.00 3.00a OS/2

Summary: Microsoft COBOL Versions 3.0 and 3.0a can initialize and use the mouse in MS OS/2 protected mode. The following example demonstrates how to call the following API routines: MouOpen MouDrawPtr MouGetNumQueEl MouReadEventQue MouClose

Code Example
The following code example demonstrates the OS/2 mouse API calls listed above:

$SET OSVS ANS85 LITLINK Working-storage section. 01 ws-null         pic 9(8) comp-5 value zeros. 01 mouse-handle    pic 9(4) comp-5. 01 Display-Return  pic 9(4) comp-5. 01 NumMouEventStruct. 05 cEvents     pic 9(4) comp-5 value 0. 05 cMaxEvents  pic 9(2) comp-5 value 0. 01 needed-input    pic x.   01 pmoueventinfo. 05 fs   pic 9(4) comp-5. 05 timex pic 9(8) comp-5. 05 rowx pic 9(4) comp-5. 05 colx pic 9(4) comp-5. 01 pfwait    pic 9(4) comp-5 value 1. Procedure Division. main-para. call &quot;__MouOpen&quot; using by reference mouse-handle by value ws-null. if RETURN-CODE not = 0 DISPLAY &quot;MOUSE OPEN ERROR&quot; EXHIBIT NAMED RETURN-CODE STOP RUN. display &quot;1-open ok&quot;. call &quot;__MouDrawPtr&quot; using by value mouse-handle. if RETURN-CODE not = 0 DISPLAY &quot;MOUSE DRAW PTR ERROR&quot; EXHIBIT NAMED RETURN-CODE STOP RUN. display &quot;2-drawptr ok&quot;. display &quot;need input&quot;. accept needed-input. call &quot;__mouGetNumQueEl&quot; using by value mouse-handle by reference NumMouEventStruct. if RETURN-CODE not = 0 DISPLAY &quot;MOUSE GETNUMQ ERROR&quot; EXHIBIT NAMED RETURN-CODE STOP RUN. display &quot;3-GETNUMQ ok&quot;. call &quot;__MouReadEventQue&quot; using by value mouse-handle by reference pfwait by reference pmoueventinfo. if RETURN-CODE not = 0 DISPLAY &quot;MOUSE READQ ERROR&quot; EXHIBIT NAMED RETURN-CODE STOP RUN. display &quot;4-READQ ok&quot;. call &quot;__MouClose&quot; using by value mouse-handle. if RETURN-CODE not = 0 DISPLAY &quot;MOUSE CLOSE ERROR&quot; EXHIBIT NAMED RETURN-CODE STOP RUN. STOP RUN. Additional reference words: 3.00 3.00a Copyright Microsoft Corporation 1993.