Announcement

Collapse
No announcement yet.

Connect to other programs without CHAIN?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Manuel Valdes
    replied
    I used this program to circumvent the lack of a dot matrix line printer and fanfold paper, when had to get old reports from a legacy accounting program. In TP compiles in a 2.45 K EXE, and it is practically invisible. PRN2FILE.COM is a small TSR. Being an EXE, it is also possible to use a direct access to run it from the desktop.


    Code:
     
    PROGRAM CONTAB;
    {$M 2096,0,0}
    USES DOS;
    VAR
    F: FILE;
    BEGIN
    ASSIGN(F,'LISTADO.TXT');
    {$I-}
    RESET(F);
    {$I+}
    IF IORESULT = 0 THEN
    BEGIN
    CLOSE(F);
    ERASE(F);
    END;
    SWAPVECTORS;
    EXEC('PRN2FILE.COM','LISTADO.TXT'); 'TSR, CAPTURE LPT 
    SWAPVECTORS;
    EXEC('ACCOUNT.EXE','');
    SWAPVECTORS;
    EXEC('PRN2FILE.COM',' /U'); 'UNINSTALL THE TSR
    SWAPVECTORS;
    EXEC('WORDPAD.EXE','LISTADO.TXT'); 'TO EDIT THE TXT FILE
    SWAPVECTORS
    END.
    Last edited by Manuel Valdes; 3 Jul 2009, 09:20 AM.

    Leave a comment:


  • Michael Mattias
    replied
    >RUN [Filespec]

    RUN may be used to execute a PBC chain file or PB-created EXE only.

    You need to use EXECUTE to transfer control to a non-PB-created EXE

    MCM

    Leave a comment:


  • Manuel Valdes
    replied
    I think this TP code can be translated to PB with little dificulty. Most probably later at home I could find a PB version of something similar. If you are working in pure MS-DOS, may be the EXE size is important (TP compile it in 10K). If you are working in windows MS-DOS then may be it worth to translate it to PBCC instead.

    Code:
     
    PROGRAM COSTS;
    {$M 2096,0,0}
    USES CRT,DOS;
     
    CONST
    OP1 = ' Sub Program #1 ';
    OP2 = ' Sub Program #2 ';
    OP3 = ' Sub Program #3 ';
    OP4 = ' Sub Program #4 ';
    OP5 = ' Sub Program #5 ';
    OP6 = ' Sub Program #6 ';
    OP7 = ' Sub Program #7 ';
    OP8 = ' Sub Program #8 ';
    OP9 = ' Sub Program #9 ';
    OP10 = ' Sub Program #10 ';
    OP11 = ' Exit to the OS ';
     
    VAR
    O : STRING[2];
    Op : INTEGER;
    REGS : REGISTERS;
    PROCEDURE ESCUR(SWI : CHAR);
    BEGIN
    REGS.AH := $01;
    IF SWI = #68 THEN
    REGS.CX := $200F
    ELSE
    REGS.CX := $0E0F;
    INTR($10,REGS)
    END;
    PROCEDURE MARCA;
    VAR
    H,I : INTEGER;
    BEGIN
    TEXTBACKGROUND(1);
    TEXTCOLOR(15);
    CLRSCR;
    TEXTBACKGROUND(0);
    FOR H := 6 TO 22 DO
    BEGIN
    GOTOXY(4,H);
    WRITE(' ':71)
    END;
    TEXTBACKGROUND(1);
    TEXTCOLOR(7);
    GOTOXY(5,5);
    WRITE('ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ');
    TEXTBACKGROUND(7);
    TEXTCOLOR(15);
    GOTOXY(5,6);
    WRITE(' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ');
    FOR H := 7 TO 20 DO
    BEGIN
    GOTOXY(5,H);
    WRITE(' ³',' ':68,'³ ')
    END;
    GOTOXY(5,21);
    WRITE(' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ');
    GOTOXY(5,22);
    TEXTCOLOR(7);
    TEXTBACKGROUND(0);
    WRITE('ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß');
    TEXTBACKGROUND(1);
    WRITE('ß');
    TEXTBACKGROUND(7);
    TEXTCOLOR(15);
    GOTOXY (23,6);
    WRITE (' C O N T R O L D E C O S T O S ');
    GOTOXY (27,21);
    WRITE (' Mover ');
    WRITE (#24);
    WRITE (#25);
    WRITE (' Elegir <Enter> ')
    END;
    PROCEDURE MARQUI(X, Y, A, H : INTEGER);
    VAR
    J : INTEGER;
    
    BEGIN
    TEXTBACKGROUND(0);
    FOR J := 1 TO H+2 DO
    BEGIN
    GOTOXY (X-1,Y+J);
    WRITE (#32)
    END;
    GOTOXY(X,Y+H+2);
    TEXTBACKGROUND(0);
    WRITE(' ');
    GOTOXY(X,Y);
    TEXTBACKGROUND(3);
    TEXTCOLOR(15);
    WRITE(#218);
    FOR J :=1 TO A DO
    BEGIN
    WRITE (#196)
    END;
    WRITE (#191);
    FOR J :=1 TO H DO
    BEGIN
    GOTOXY (X,Y+J);
    WRITE (#179);
    GOTOXY (X + A + 1, Y + J);
    WRITE (#179)
    END;
    GOTOXY (X,Y+H+1);
    TEXTCOLOR(15);
    TEXTBACKGROUND(3);
    WRITE (#192);
    FOR J := 1 TO A DO
    WRITE (#196);
    WRITE (#217);
    END;
    PROCEDURE OPTS;
    BEGIN
    GOTOXY (10,09);
    WRITE (OP1);
    GOTOXY (47,09);
    WRITE (OP6);
    GOTOXY (10,11);
    WRITE (OP2);
    GOTOXY (47,11);
    WRITE (OP7);
    GOTOXY (10,13);
    WRITE (OP3);
    GOTOXY (47,13);
    WRITE (OP8);
    GOTOXY (10,15);
    WRITE (OP4);
    GOTOXY (47,15);
    WRITE (OP9);
    GOTOXY (10,17);
    WRITE (OP5);
    GOTOXY (47,17);
    WRITE (OP10);
    GOTOXY (30,19);
    WRITE (OP11);
    END;
    PROCEDURE SMENU(X,Y:INTEGER);
    CONST
    SOP1 = ' Registro de Consumos ';
    SOP2 = ' Materiales en Stock ';
    SOP3 = ' Registro de Compras ';
    VAR
    O : STRING[2];
    SOP : INTEGER;
    BEGIN
    SOP := 1;
    MARQUI(X,Y,22,3);
    REPEAT
    GOTOXY (X+1,Y+1);
    WRITE (SOP1);
    GOTOXY (X+1,Y+2);
    WRITE (SOP2);
    GOTOXY (X+1,Y+3);
    WRITE (SOP3);
    TEXTBACKGROUND(4);
    TEXTCOLOR(15);
    CASE SOP OF
    1 : BEGIN
    GOTOXY (X+1,Y+1);
    WRITE (SOP1)
    END;
    2 : BEGIN
    GOTOXY (X+1,Y+2);
    WRITE (SOP2)
    END;
    3 : BEGIN
    GOTOXY (X+1,Y+3);
    WRITE (SOP3)
    END;
    END;
    TEXTBACKGROUND(3);
    TEXTCOLOR(15);
    REPEAT
    UNTIL KEYPRESSED;
    O := READKEY;
    IF POS(#72,O) = 1 THEN
    BEGIN
    IF SOP = 1 THEN
    SOP := 3
    ELSE
    SOP := SOP - 1
    END;
    IF POS(#80,O) = 1 THEN
    BEGIN
    IF SOP = 3 THEN
    SOP := 1
    ELSE
    SOP := SOP + 1
    END;
    IF POS(#13,O) = 1 THEN
    BEGIN
    CASE SOP OF
    1 : BEGIN
    SWAPVECTORS;
    EXEC('CONMATST.EXE','');
    SWAPVECTORS;
    MARCA;
    OPTS;
    MARQUI(X,Y,22,3)
    END;
    2 : BEGIN
    SWAPVECTORS;
    EXEC('MATSTOCK.EXE','');
    SWAPVECTORS;
    MARCA;
    OPTS;
    MARQUI(X,Y,22,3)
    END;
    3 : BEGIN
    SWAPVECTORS;
    EXEC('COMMATST.EXE','');
    SWAPVECTORS;
    MARCA;
    OPTS;
    MARQUI(X,Y,22,3)
    END;
    END;
    END;
    UNTIL POS(#27,O) = 1;
    END;
    BEGIN
    ESCUR(#68);
    Op := 1;
    MARCA;
    REPEAT
    OPTS;
    TEXTBACKGROUND(4);
    TEXTCOLOR(15);
    CASE Op OF
    1 : BEGIN
    GOTOXY (10,09);
    WRITE (Op1)
    END;
    2 : BEGIN
    GOTOXY (10,11);
    WRITE (Op2)
    END;
    3 : BEGIN
    GOTOXY (10,13);
    WRITE (Op3)
    END;
    4 : BEGIN
    GOTOXY (10,15);
    WRITE (Op4)
    END;
    5 : BEGIN
    GOTOXY (10,17);
    WRITE (Op5)
    END;
    6 : BEGIN
    GOTOXY (47,09);
    WRITE (Op6)
    END;
    7 : BEGIN
    GOTOXY (47,11);
    WRITE (Op7)
    END;
    8 : BEGIN
    GOTOXY (47,13);
    WRITE (Op8)
    END;
    9 : BEGIN
    GOTOXY (47,15);
    WRITE (Op9)
    END;
    10 : BEGIN
    GOTOXY (47,17);
    WRITE (Op10)
    END;
    11 : BEGIN
    GOTOXY (30,19);
    WRITE (Op11)
    END
    END;
    TEXTBACKGROUND(7);
    TEXTCOLOR(15);
    REPEAT
    UNTIL KEYPRESSED;
    O := READKEY;
    IF POS(#72,O) = 1 THEN
    BEGIN
    IF Op = 1 THEN
    Op := 11
    ELSE
    Op := Op - 1
    END;
    IF POS(#80,O) = 1 THEN
    BEGIN
    IF Op = 11 THEN
    Op := 1
    ELSE
    Op := Op + 1
    END;
    IF POS(#75,O) = 1 THEN
    BEGIN
    IF Op < 6 THEN
    Op := Op + 5
    ELSE
    Op := Op - 5
    END;
    IF POS(#77,O) = 1 THEN
    BEGIN
    IF Op > 5 THEN
    Op := Op - 5
    ELSE
    Op := Op + 5
    END;
    IF POS(#13,O) = 1 THEN
    BEGIN
    IF Op<>5 THEN
    BEGIN
    TEXTBACKGROUND(1);
    CLRSCR;
    ESCUR(#65)
    END;
    CASE Op OF
    1 : BEGIN
    SWAPVECTORS;
    EXEC('REGOTEC.EXE','');
    SWAPVECTORS
    END;
    2 : BEGIN
    SWAPVECTORS;
    EXEC('REGIPERS.EXE','2');
    SWAPVECTORS
    END;
    3 : BEGIN
    EXEC('GASTHHPP.EXE','1');
    END;
    4 : BEGIN
    SWAPVECTORS;
    EXEC('COMPRMAT.EXE','2');
    SWAPVECTORS
    END;
    5 : BEGIN
    SMENU(11,15)
    END;
    6 : BEGIN
    SWAPVECTORS;
    EXEC('COMPRMAT.EXE','4');
    SWAPVECTORS
    END;
    7 : BEGIN
    SWAPVECTORS;
    EXEC('COMPRMAT.EXE','5');
    SWAPVECTORS
    END;
    8 : BEGIN
    SWAPVECTORS;
    EXEC('COMPRMAT.EXE','6');
    SWAPVECTORS
    END;
    9 : BEGIN
    SWAPVECTORS;
    EXEC('COMPRMAT.EXE','7');
    SWAPVECTORS
    END;
    10 : BEGIN
    SWAPVECTORS;
    EXEC('RESOCES.EXE','');
    SWAPVECTORS
    END;
    END;
    ESCUR(#68);
    MARCA
    END;
    UNTIL (Op = 11) AND (POS(#13,O) = 1);
    TEXTBACKGROUND(0);
    TEXTCOLOR(7);
    CLRSCR;
    ESCUR(#65)
    END.

    Leave a comment:


  • Scott Slater
    replied
    Heres the batch file that I ran to run the menu system. This allows the menu exe to be totally removed from memory while the other program runs, and then returns.

    Code:
    @ECHO OFF
    _MENUAP NORMSTART 1
    :NEXTLOOP
    IF EXIST LAUNCHAP.BAT GOTO RUNCMD
    GOTO ENDBAT
    :RUNCMD
    CALL LAUNCHAP.BAT
    DEL LAUNCHAP.BAT
    _MENUAP RETURNRUN 1 A1
    GOTO NEXTLOOP
    :ENDBAT
    Just name this batch file MENU.BAT and launch it to launch your menu program. The menu program creates LAUNCHAP.BAT and exits, to run another program, or just exits to quit.

    Leave a comment:


  • Scott Slater
    replied
    I wrote a DOS menu program years ago. For it I started the program with a BATCH which had some conditional branches depending on what error level my menu program exited with. From there the batch file would call another batch file which was created by the menu program that launched the 2nd program. When it returned, the batch file would re-run my program with a special command line letting it know that it was being run returning from a launched program rather than simply being started up. I'll dig around on my server and see if I can find that batch file to post it here.

    Leave a comment:


  • Manuel Valdes
    replied
    What I did was to write a small program consisting merely in a Menu, which shelled to every program I wanted to have in the tip of my fingers. Just for the very low memory requirement, sometimes I did it in Pascal.

    Best Regards,

    Leave a comment:


  • Mel Bishop
    replied
    RUN [Filespec]

    Leave a comment:


  • Robert E. Carneal
    started a topic Connect to other programs without CHAIN?

    Connect to other programs without CHAIN?

    I know I can use CHAIN and pass values to another child program. But, what if I have no desire to return (and no desire to pass values) to either the child or parent program? Is chain still the best way to go from program to program?

    In other words, when my program ends, I do NOT want it to go back to the parent program. I am wondering if there is a better way to "move" from program to program?

    Thanks.

    Robert
Working...
X