/**************/ /* hellopri.c */ /***************************************************************************** PROGRAM: hellopri.c PURPOSE: Hello World! tulostetaan Windowsin oletuskirjoittimelle PROJECT: hellopri.c tulostus.def Editor: Vesa Lappalainen 2.11.1992 ( mukaellen Charles Petzoldia) Luetaan WIN.INI -tiedostosta oletuskirjoitin: [windows] device=QMS-PS 810,pscript,LPT1.OS2 *****************************************************************************/ #include #include /****************************************************************************/ HDC CreatePrinterDC (void) { static char s[80] ; char *szDevice, *szDriver, *szOutput ; GetProfileString ("windows", "device", ",,,", s,sizeof(s)) ; if ( (szDevice = strtok (s ,"," ) ) != NULL && (szDriver = strtok (NULL,",") ) != NULL && (szOutput = strtok (NULL,",") ) != NULL ) return CreateDC (szDriver, szDevice, szOutput, NULL) ; return 0; } //#include "kolmiom.h" /****************************************************************************/ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) { #pragma argsused HDC hdcPrinter = CreatePrinterDC() ; if ( hdcPrinter == NULL) return 1; if ( Escape(hdcPrinter,STARTDOC,8,"HelloPri",NULL) <= 0 ) return 2; TextOut(hdcPrinter,20,20,"Hello World!",12); // MyDraw(NULL,hdcPrinter); Escape(hdcPrinter, NEWFRAME, 0 , 0L, 0L); Escape(hdcPrinter, ENDDOC, 0 , 0L, 0L); DeleteDC(hdcPrinter) ; return 0; }