#include ”faxcpp.h”
FAXOBJ far CreateSendFax (char FaxType, struct TSFaxParam far *Param)
|
Class 1. |
Class 2. Class 2.0 |
Brooktrout
|
GammaLink
|
NMS
|
Description
This function creates and returns a FAX object “new TCNormalFax(TRUE)” with the parameters set in the TSFaxParam. The FaxType variable contains the type of the fax. The driver will handle the normal faxes in this release. The type of the normal fax is ‘N’ (it is defined as REGTYPE_NORMALFAX ). The type of Binary File Transfer is ‘B’ (it is defined as REGTYPE_BINARYFILE). The ‘C’ is reserved for the Color FAX type. The ‘B’ is reserved for Binary File transfer. The ‘M’ is reserved for multi-media applications.
Please Note: it is very important to set the page number parameter.
Parameters
|
char |
FaxType |
Type of fax. (Must be ‘N’ or ‘B’), ‘C’ and ‘M’ are reserved. |
|
struct TSFaxParam far |
*Param |
Pointer to a fax parameter structure. |
Return Value
Returns a FAX object.
Sample Code
TSFaxParam sFaxParam;
CImgApp *pApp = (CImgApp *)AfxGetApp();
if(pApp->FaxPorts[0]) {
sFaxParam.PageNum = 1;
sFaxParam.Resolut = RES_98LPI;
sFaxParam.Width = PWD_NOCHANGE;
sFaxParam.Length = PLN_NOCHANGE;
sFaxParam.Compress = DCF_1DMH;
sFaxParam.Binary = BFT_NOCHANGE;
sFaxParam.BitOrder = BTO_FIRST_LSB;
// Get remote fax number.
GetDlgItemText(IDC_FAXNUMBER, sFaxParam.RemoteID, sizeof(sFaxParam.RemoteID));
sFaxParam.Send = TRUE;
FAXOBJ foFax = CreateSendFax('N', &sFaxParam );
if(!foFax) {
// Creating fax is failed
} else {
union TUFaxImage sFaxPage;
sFaxPage.Dib = pDoc->hDib;
if(!SetFaxImagePage(foFax, 0, IMT_MEM_DIB, &sFaxPage, 0)) {
// Get our identification string.
CString cId = pApp->GetProfileString("Fax", "Identification String", NULL);
char szBuffer[80];
strncpy(szBuffer, cId, sizeof(szBuffer));
SetMyID(szBuffer);
if(bSendQueue) {
if(SetFaxSendQueue(foFax)) {
// Put fax into the queueihas failed.
}
} else if(PutFaxOnQueue(pApp->FaxPorts[0], foFax, FALSE)) {
// Sending fax immediate has failed.
}
} else {
// Setting the image page has failed.
}
}
} else {
// No port is opened.
}