Microsoft KB Archive/50735

= Linking QuickBasic 4.50 with QuickC 2.00, 2.01 Font Library =

Article ID: 50735

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft QuickBasic 4.0, when used with:
 * Microsoft MS-DOS 6.22 Standard Edition
 * Microsoft QuickBASIC 4.0b, when used with:
 * Microsoft MS-DOS 6.22 Standard Edition
 * Microsoft QuickBasic 4.5 for MS-DOS, when used with:
 * Microsoft MS-DOS 6.22 Standard Edition
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Professional Development System 7.0

-



This article was previously published under Q50735



SUMMARY
QuickBasic Version 4.50 and Microsoft Basic PDS Version 7.00 can call routines contained in the QuickC Version 2.00 or 2.01 font library. One restriction is that the QuickBasic program must be compiled with the BRUNxx.EXE option, or it will not link with the C program. Basic PDS 7.00 is also restricted and must be linked with the BRT70xxx.EXE option. Note also that the QuickBasic program must make a call to SETMEM to release far memory that the C routine will need to use for its workspace.

This information about interlanguage calling applies to QuickBasic Versions 4.00, 4.00b, and 4.50 for MS-DOS, to Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2, and to Microsoft Basic PDS Version 7.00 for MS-DOS and MS OS/2.



MORE INFORMATION
The following is a sample program that demonstrates calling a C routine to display text in the Times Roman Bold font. This sample is based on the sample program given on Page 268 of the &quot;Microsoft C for Yourself Version 2.0&quot; manual that comes with QuickC Versions 2.00 and 2.01.

Code Example
The following Basic program is CFONT.BAS, which calls a C routine to display text on the screen in the Times Roman Bold font: DECLARE SUB WriteTMSRB CDECL ' Release the available far memory for the C routine: ' Note: This releases the entire far heap. This probably should ' not be done with programs that use $DYNAMIC arrays. X = SETMEM(-FRE(-1)) CALL WriteTMSRB END

The following C routine is TMSRB.C, which calls the Font library routines to display text on the screen in the Times Roman Bold font:


 * 1) include 
 * 2) include 

void WriteTMSRB { int mode = _VRES16COLOR;

/* Read header info from .FON file */ if (_registerfonts(&quot;TMSRB.FON&quot;) < 0) {   _outtext(&quot;ERROR: can't register fonts&quot;); exit (0); }

/* Set highest available video mode */ while(!_setvideomode(mode)) mode--; if (mode == _TEXTMONO) exit(0);

/* Set font and display text */ if (!_setfont (&quot;t'helv'h30w24b&quot;)) {   _moveto(10,10); _outgtext(&quot;THIS IS IN TIMES ROMAN BOLD&quot;); getch; } else {   _setvideomode(_DEFAULTMODE); _outtext(&quot;ERROR: can't set font&quot;); exit(0); }

_setvideomode(_DEFAULTMODE); _unregisterfonts; } For QuickBasic, the steps to compile and link are as follows: BC CFONT.BAS; QCL /c /AM TMSRB.C  LINK /noe /nod CFONT+TMSRB,,,BRUN45.LIB+MLIBCE.LIB+GRAPHICS.LIB; For Basic PDS 7.00, the steps to compile and link are as follows: BC CFONT.BAS; QCL /c /AM TMSRB.C  LINK /noe /nod CFONT+TMSRB,,,BRT70ENR.LIB+MLIBCE.LIB+GRAPHICS.LIB;

Additional query words: QuickBas BasicCom

Keywords: KB50735

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.