| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | pm print sample 1/2 |
/*
* This sample program contains the least amount of code I could write
* to do PM text printing, to the system default printer.
*
* I purposefully wrote most of the code in one huge function so that
* you can see the steps that are required -- I was unable to find such a
* sampe when _I_ needed one.
*
* I have also removed much of the error detection code.
*
* This sample follows recommendations for WARP; it will probably work
* with OS/2 2.1 but NOT 2.0.
*
* Peter Fitzsimmons, Fri 95-09-29 02:47:16am.
*
* IBM : icc /Q /Kb /W3 /SS /O printsam.c /B"/pm:pm"
* Watcom: wcl386 /Ox /W4 /Zq /Zp4 /s /k0x4000 printsam.c /l=os2v2_pm
*/
#define INCL_PM
#define INCL_SPL
#define INCL_SPLDOSPRINT
#define INCL_ERRORS
#include
#include
#include
#include
#include
static HAB gHab;
static FONTDLG gFontDlg;
static int Print(void);
static int Font(HPS hpsPrinter);
static void gputs(HPS hps, int yInc, LONG yTop, int line, char *string);
#define pmassert assert
int main(void)
{
HMQ hmq;
if ((gHab = WinInitialize(0)) == 0L)
return 1;
if ((hmq = WinCreateMsgQueue(gHab, 0)) == 0L)
return 1;
Print();
WinDestroyMsgQueue(hmq);
WinTerminate(gHab);
return 0;
}
// ask the user to chose a font.
static int Font(HPS hpsPrinter)
{
char Family[90];
memset(&gFontDlg, 0, sizeof(FONTDLG));
gFontDlg.cbSize = sizeof(FONTDLG);
gFontDlg.usFamilyBufLen = sizeof(Family);
gFontDlg.pszFamilyname = Family;
gFontDlg.pfnDlgProc = NULL;
gFontDlg.clrFore = CLR_BLACK;
gFontDlg.clrBack = CLR_WHITE;
gFontDlg.ulUser = 0;
gFontDlg.usWeight = 0;
gFontDlg.fAttrs.usCodePage = 850;
gFontDlg.fl = FNTS_CENTER | FNTS_INITFROMFATTRS | FNTS_VECTORONLY;
gFontDlg.flFlags = 0; //FNTF_NOVIEWSCREENFONTS;
gFontDlg.hpsScreen = WinGetScreenPS(HWND_DESKTOP);
gFontDlg.hpsPrinter = hpsPrinter;
WinFontDlg(HWND_DESKTOP, HWND_DESKTOP, &gFontDlg);
WinReleasePS(gFontDlg.hpsScreen);
return 0;
}
// print a line of text.
static void gputs(HPS hps, int yInc, LONG yTop, int line, char *string)
{
POINTL pt;
pt.x = 0;
pt.y = yTop - (yInc * line);
GpiCharStringAt(hps, &pt, strlen(string), string);
}
--- Maximus/2 3.00
* Origin: Sol 3 * Toronto * V.32 * (905)858-8488 (1:259/414)SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407 SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809 @PATH: 259/414 400 99 229/2 3615/50 396/1 270/101 712/515 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.