SetFaxHeader

C API

#include ”faxcpp.h”

int SetFaxHeader(FAXOBJ Fax, TSHeaderContext *lpHeader)

C++ API

#include ”faxclass.h”

virtual int TCFaxNormal::SetFaxHeader(TSHeaderContext *lpHeader)

Class 1.

Class 2.

Class 2.0

Brooktrout

 

GammaLink

 

Dialogic

 

NMS

 

g

g

 

 

g

g

Description

This function sets the fax header string for outgoing faxes.

When using this function, please set the Structure member alignment to 1 in your project settings. Without this setting the header on the fax page will be incorrect or missing.

Parameters

TSHeaderContext

*lpHeader

Pointer to a TSHeaderContext structure which describes the contents of the header. This header will be used for every page set by calls to SetImagePage routine until another call to SetFaxHeader.

Return Value

Returns zero on success, otherwise an error code is returned


Sample Code

TSHeaderContext header;

       struct tm   ctm;

       time_t      CurTime=time(NULL);

       TSSessionParameters sess;

       ctm = *localtime( &CurTime );

       GetSessionParameters( m_faxport, &sess );

       wsprintf( header.lpszFrom, "From : %s ", sess.LocalID );

       wsprintf( header.lpszTo, "To : %s", sFaxParam.RemoteNumber );

       wsprintf( header.lpszDateTimePage, "On : %s", asctime( &ctm ) );

       header.Height = 25;

       for ( int i=0 ; i<3 ; i++ ) {

           strcpy( header.Record[i].Name, “”);

           strcpy( header.Record[i].Type, “” );

           strcpy( header.Record[i].FontFaceName , “Courier_New” );

           header.Record[i].FontSize = 8;

           header.Record[i].Weight = 0;

           header.Record[i].Italic = 0;

           header.Record[i].Underline = 0;

           header.Record[i].StrikeOut = 0;

       }

       SetRect( &header.Record[0].Position,0,50, 52,100 );

       SetRect( &header.Record[1].Position, 662,50, 1211,100 );

       SetRect( &header.Record[2].Position, 1212,50, 1212+600,100 );

       faxobj->SetFaxHeader( &header );

 

The following example shows how to create a header that contains page numbers, current date and time, a To:  and a FROM: field :

TSHeaderContext header;

GetSessionParameters( m_faxport, &sess );

 

        wsprintf( header.lpszFrom, "From: %s To: %%f", sess.LocalID );   //%f will be replaced with the destination phone number

        wsprintf( header.lpszTo, "Page %%c of %%p" ); //%c will be replaced with the current page number, %p with the total page number in the fax

        wsprintf( header.lpszDateTimePage, "On: %%t, %%D");// %t will be replaced with the current time, %d with the current date.

        header.Height = 25;

        for ( int i=0 ; i<3 ; i++ ) {

            strcpy( header.Record[i].Name, “”);

            strcpy( header.Record[i].Type, “” );

            strcpy( header.Record[i].FontFaceName , “Courier_New” );

            header.Record[i].FontSize = 8;

            header.Record[i].Weight = 0;

            header.Record[i].Italic = 0;

            header.Record[i].Underline = 0;

            header.Record[i].StrikeOut = 0;

        }

        SetRect( &header.Record[0].Position,0,50, 52,100 );

        SetRect( &header.Record[1].Position, 662,50, 1211,100 );

        SetRect( &header.Record[2].Position, 1212,50, 1212+600,100 );

        faxobj->SetFaxHeader( &header );