The following is a sample 'setup' for sending a Panel data stream to DESQview as well as the code needed to create and open the Keyboard, Mouse, Window, and Object object handles. This example is designed to take various topics in the DESQview API and combine them into a usable example. The resulting window contains 18 fields selectable with the mouse or the keyboard. The data returned by DESQview with this setup allows the mouse and the keyboard to behandled as the same logical input device. Keep in mind that this is a program fragment, not a complete program. It is merely intended to demonstrate sample procedures to create a window with selectable fields using the keyboard or the mouse. Daniel Travison. ;+-------------------------------------+ ;| Desqview handle/window setup | ;| Window | ;| Keyboard Object | ;| Mouse Object | ;| Object Queue | ;+-------------------------------------+ SET_UP PROC NEAR ; STEP: get window handle @SEND HANDLE,ME ;request window handle @POP WNDW_OBJ ;get handle ; STEP: send the window data stream to initialize display LEA SI,WNDW_DATA ;window data stream MOV AX,WNDW_DATL ;length of data stream CALL WNDW_CMND ;write it to the display ; STEP: open pointer object @SEND NEW,POINTER ;request pointer handle @POP PNTR_OBJ ;save it @PUSH WNDW_OBJ ;window handle @SEND OPEN,PNTR_OBJ ;open pointer ; STEP: open keyboard object @SEND HANDLE,KEYME ;request keyboard handle @POP KYBD_OBJ ;save it @PUSH WNDW_OBJ ;window handle @SEND OPEN,KYBD_OBJ ;open keyboard ; STEP: set multiple clicks as one, clicks only sent XOR BX,BX ;clear high byte MOV AX,10h+01h ;mask @PUSH_BXAX ;push it @SEND ADDTO,PNTR_OBJ ;set options ; STEP: set field mode XOR BX,BX ;clear high byte MOV AX,01h ;mask @PUSH_BXAX ;push mask @SEND ADDTO,KYBD_OBJ ;set options ; STEP: turn off the hardware cursor XOR BX,BX ;clear high byte MOV AX,02h ;mask @PUSH_BXAX ;push mask @SEND SUBFROM,KYBD_OBJ ;set options ; STEP: open Object Q ; the object queue is used to determine which, ; if any, queues have data waiting. In this setup, ; data is read from the keyboard and the mouse in ; the same manner and can be processed as if from the ; the same source. @SEND HANDLE,OBJQME ;request pointer handle @POP OBJQ_OBJ ;save it @SEND OPEN,OBJQ_OBJ ;open Object Q ; STEP: send window manager data LEA SI,REG_WNDW ;data to send MOV AX,REG_WNDWL ;length CALL WNDW_CMND ;send it RET ;done with object setup SET_UP ENDP ;+-------------------------------------+ ;| send data streams to desqview | ;| DSSI: pointer to data stream | ;| AX: data length | ;+-------------------------------------+ WNDW_CMND PROC NEAR PUSH BX ;save modified PUSH AX ; registers XOR BX,BX ;clear @PUSH_DSSI ;push address to data @PUSH_BXAX ;data length @SEND WRITE,ME ;send it POP AX ;restore modified POP BX ; registers RET ;return WNDW_CMND ENDP ;+-------------------------------------+ ;| get input from keyboard or mouse | ;| :read the object Q | ;| :use returned object handle to | ;| read the appropriate object Q | ;| this makes the assumption that | ;| only keyboard and mouse objects | ;| are used (probally questionable) | ;| and should be expanded to check | ;| the handle, if not what we want | ;| then simply read and ignore | ;| the the data. | ;| | ;| AH: select status | ;| AL: field number | ;+-------------------------------------+ GET_INPT PROC NEAR @PUSH_ESDI ;save them if you need to @PUSH_DXCX ; STEP: read object q for handle of object with input waiting @SEND READ,OBJQ_OBJ ;read the object queue @POP_BXAX ;handle of object with input waiting ; STEP: use returned handle to read field number and select status pointers @SEND READ,BXAX ;read the message @POP_DXCX ; retrieve the @POP_ESDI ; returned data ; STEP: get the field number and the select status MOV AL,ES:[DI] ;get field number MOV AH,ES:[DI+2] ; select/deselect status @POP_DXCX ;restore the registers used @POP_ESDI END_INPT: RET ;return GET_INPT ENDP The following is a layout for the Panel description. The necessary equates and data definitions are included. I hope this may be helpful for setting up panel definitions within your programs. ESCP EQU 1Bh ;escape character CR EQU 13 ;carriage return LF EQU 10 ;line feed ATTR EQU 7 ;normal display attribute SLCT_ON EQU 0C2h ;field selected code SLCT_OFF EQU 0C0h ;field deselected code FLD_FRMAT EQU 11000000b ;define field table type ;11 ............. selectable field ; 0 ............. non-output field ; 000 ............. reserved ; 0 ............. select status (reserved) ; 0 ............. modified status (reserved) FLD_INACT EQU 00000000b ;define field table type ;00 ............. inactive field ; 0 ............. non-output field ; 000 ............. reserved ; 0 ............. select status (reserved) ; 0 ............. modified status (reserved) ;+-------------------------------------+ ;| OBJECT handle, printer number, | ;| field number, and printer settings | ;| save areas | ;+-------------------------------------+ WNDW_OBJ DW 2 DUP(0) ;window object handle OBJQ_OBJ DW 2 DUP(0) ;object Q handle PNTR_OBJ DW 2 DUP(0) ;pointer object handle KYBD_OBJ DW 2 DUP(0) ;keyboard object handle LPT_NUM DW 0 ;BIOS printer number FIELD_NUM DB 0 ;current field number PRT_SAVE DB 30 DUP(SLCT_OFF) ;table, save printer settings ; default is all deselected ;+-------------------------------------+ ;| Window data stream. Defines all the| ;| necessary characteristics needed | ;| for setting up selectable fields, | ;| the menu of options, etc. Although | ;| 'hand coded' the release of the | ;| window design tool due this summer | ;| will allow this code to be generated| ;| automatically. | ;+-------------------------------------+ WNDW_DATA DB ESCP,00h ;window data stream header DW WNDW_DATL - 4 ;length of the entire data ;stream less the header data DB 0E5h ;indicates field table or panel DB 10101000b ;indicate field select info ;10 ............. new field table ; 1 ............. field table present ; 0 ............. no input fields ; 1 ............. select on, input off ; 000 ............. reserved DB 0D5h ;hide window till ready DB 0C0h,0,0 ;move cursor to upper left ; display data for the menu DB 98h + DSPL_DATL/256, DSPL_DATL MOD 256 DSPL_DATA DB ' DV Set Printer v2.0 ',CR,LF DB 'ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ',CR,LF MENU_OPT DB ' Compressed ......... A ',CR,LF DB ' Double width ....... B ',CR,LF DB ' Underline .......... C ',CR,LF DB ' Italic ............. D ',CR,LF DB ' Paper sense ........ E ',CR,LF DB ' Emphasized ......... F ',CR,LF DB ' Double strike ...... G ',CR,LF DB ' Superscript ........ H ',CR,LF DB ' Subscript .......... I ',CR,LF DB ' Unidirection ....... J ',CR,LF DB 'ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ',CR,LF DB ' Linefeed ........... K ',CR,LF DB ' Form Feed .......... L ',CR,LF DB ' Reset .............. M ',CR,LF DB ' Customize .......... O ',CR,LF DB ' Exit program ....... X ',CR,LF DB 'ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ',CR,LF DB ' Lpt 1 Lpt 2 Lpt 3 ' DSPL_DATL EQU $-DSPL_DATA ; field table definition DB 0FFh ;define field table DB 18 ;number of fields DB 01001111b ;field format ;0 reserved ; 1 keystroke select on ; 0 button 1, select ; 0 " 2, select ; 1 return Y/N ; 1 auto-reset fields ; 11 return modified field DB 00 ;reserved, current input field DB 00 ;reserved, current select field DB 7*16+8 ;pointed-at field attr DB 7*16+0Fh ;selected field attr ; start-row,start-col,end-row,end-col,format,select key,attribute DB 02,21,02,23,FLD_FRMAT,'A',ATTR DB 03,21,03,23,FLD_FRMAT,'B',ATTR DB 04,21,04,23,FLD_FRMAT,'C',ATTR DB 05,21,05,23,FLD_FRMAT,'D',ATTR DB 06,21,06,23,FLD_FRMAT,'E',ATTR DB 07,21,07,23,FLD_FRMAT,'F',ATTR DB 08,21,08,23,FLD_FRMAT,'G',ATTR DB 09,21,09,23,FLD_FRMAT,'H',ATTR DB 10,21,10,23,FLD_FRMAT,'I',ATTR DB 11,21,11,23,FLD_FRMAT,'J',ATTR DB 13,21,13,23,FLD_FRMAT,'K',ATTR DB 14,21,14,23,FLD_FRMAT,'L',ATTR DB 15,21,15,23,FLD_FRMAT,'M',ATTR DB 16,21,16,23,FLD_FRMAT,'O',ATTR DB 17,21,17,23,FLD_FRMAT,'X',ATTR DB 19,05,19,07,FLD_FRMAT,'1',ATTR DB 19,13,19,15,FLD_FRMAT,'2',ATTR DB 19,21,19,23,FLD_FRMAT,'3',ATTR ; misc data stream settings DB 0F6h ;set startup printer field PRINT_FLD DB 16,SLCT_ON ; to be selected DB 0E2h,7 ;set current output attribute DB 0D4h ;make window visible DB 0E4h ;redraw window WNDW_DATL EQU $-WNDW_DATA ;length of window data stream ;+-------------------------------------+ ;| window manager data stream to set | ;| overall characteristics of the | ;| window as well as moving the | ;| pointer to the default printer | ;| field | ;+-------------------------------------+ REG_WNDW DB ESCP,10h ;window manager data stream DW REG_WNDWL-4 ;length of stream DB 0C2h ;make window topmost DB 23h ;inhibit vertical and DB 22h ; horizontal size changing DB 0C4h ;move pointer to the START_FLD DB 16 ; startup printer field DB 0,0 ; row/col offsets = 0 REG_WNDWL EQU $-REG_WNDW