FaxMan Jr
C Source Code for Creating a Cover Page

C Source Code for Creating a Cover Page

 

 

#include <windows.h>

 

#include <sys/stat.h>

#include <io.h>

 

#include "portable.h"

#include "cover.h"

 

#define STRING( x, y, x2, y2, s, clr, flg ) \

 tx.nX1 = x; tx.nY1 = y; tx.nX2 = x2; tx.nY2 = y2; tx.rgbColor = clr; tx.nFlags = flg; \

 Rec.nOpCode = TEXT_OBJ; Rec.nRecLen = sizeof(Rec) + sizeof(tx) + sizeof(Str) + 1; write( fd, &Rec, sizeof(Rec) );\

 write( fd,  &tx, sizeof(tx)); write( fd, Str, sizeof(Str)+1);

 

 

main()

{

 int fd;

 COVERREC Rec;

 FONTREC fr;

 TEXTREC tx;

 LINEREC lr;

 BITMAPREC bm;

 

 char Str[100];

 

 fd = _creat("cover.pg", _S_IWRITE );

 

 if( fd < 0 ) {

  printf("Error creating file...."); 

  exit(-1);

 }

 

 // Write our background record 

 Rec.nOpCode = BITMAP_OBJ;

 strcpy( Str, "FaxMan.fmf");

 Rec.nRecLen = sizeof(Rec) + sizeof(bm) + strlen(Str) + 1;

 

 write( fd, &Rec, sizeof(Rec) );

 

 write( fd, &bm, sizeof(bm) );

 

 write( fd, Str, strlen(Str)+1 );

 

 // Write a Font Record

 Rec.nOpCode = FONT_OBJ;

 

 strcpy( fr.szFontName, "Arial" );

 fr.nSize = 300;

 fr.bBold = 0;

 fr.bUnderline = 0;

 fr.bItalic = 0;

 fr.rgbColor = RGB(0, 0, 0);

 

 write( fd, &Rec, sizeof(Rec) );

 write( fd, &fr, sizeof(fr) );

 

 // Write a Text record  

 strcpy( Str, "%s");

 STRING( 720, 10000, 3500, 11400, Str, 0, DT_RIGHT ); 

 

 // Write Text

 strcpy( Str, "%d");

 STRING( 7200, 1620, 10800, 2000, Str, 0, DT_LEFT ); 

 

 strcpy( Str, "%t");

 STRING( 7200, 2500, 10800, 3000, Str, 0, DT_LEFT ); 

 

 strcpy( Str, "%p");

 STRING( 7200, 3400, 10800, 7000, Str, 0, DT_LEFT ); 

 

 strcpy( Str, "%r");

 STRING( 7200, 5000, 10800, 7000, Str, 0, DT_LEFT ); 

 

 strcpy( Str, "%f" );

 STRING( 7800, 6650, 10800, 14400, Str, 0, DT_LEFT ); 

 

 strcpy( Str, "%o" );

 STRING( 6048, 7700, 10800, 14400, Str, 0, DT_LEFT | DT_WORDBREAK ); 

 

 close(fd );

}

 

 


© 2014 Data Techniques, Inc. All Rights Reserved.

Send comments on this topic.