#include ”faxcpp.h”
#include ”faxbft.h”
int
far SetFaxImagePage( FAXOBJ Fax, int
PageNum, TEImageType Type,
union TUFaxImage far *PageImage, int ImageNum )
|
Class 1. |
Class 2. Class 2.0 |
Brooktrout
|
GammaLink
|
Dialogic
|
NMS
|
Description
This function sets the new page of the given fax by calling the TCNormalFax::SetImagePage function. The image can be passed either from a memory handle or from a file. The number of fax pages is zero based. The name of the file must be specified in the TUFaxImage union (See also TUFaxImage description). The types of the image pages can be:
IMT_MEM_DIRECT Memory handle to a raw data
The Data type depends on FaxObject type
CCITT encoded - on Normal Fax.
BFT encoded - on Bft Fax
The driver does not validate data
In ECM mode enable to send Custom Data to remote fax station
IMT_MEM_BITMAP Memory handle to a device dependent bitmap.
IMT_MEM_DIB Memory handle to a device independent bitmap.
IMT_FILE_DIRECT Raw data in file.
The Data type depends on FaxObject type
CCITT encoded - on Normal Fax.
BFT encoded - on Bft Fax
The driver not validate data
In ECM mode, enable to send Custom Data to remote fax station
IMT_FILE_BMP The image is given as a Windows bitmap file.
IMT_FILE_PCX The image is given as a PCX file (requires BIPCX.DLL, licensed separately)
IMT_FILE_DCX The image is given as a DCX file.
IMT_FILE_TIFF_NOCOMP The image is given as an uncompressed TIFF file.
IMT_FILE_TIFF_PACKBITS The image is given as a TIFF file with pack bits compression.
IMT_FILE_TIFF_LZW The image is given as a TIFF file with LZW compression.
IMT_FILE_TIFF_LZDIFF The image is given as a TIFF file with differential LZW compression.
IMT_FILE_TIFF_G31DNOEOL The image is given as a TIFF file with Group 3 one dimensional NoEol compression..
IMT_FILE_TIFF_G31D The image is given as a TIFF file with Group 2 one dimensional.
IMT_FILE_TIFF_G32D The image is given as a TIFF file with Group 3 two dimensional compression..
IMT_FILE_TIFF_G4 The image is given as a TIFF file with G4 compression.
IMT_FILE_TGA The image is given as a TGA file (requires BIPCX.DLL, licensed separately)
IMT_FILE_JPEG The image is given as a JPEG file
IMT_BFTOBJ The page is a BFT page. The PageImage -> BftObj member must point to a valid TCBinaryParam object.
The ImageNum specifies which image should be used in a multi-image file. The TIFF and DCX file formats allow storage of multiple images in a single file. The ImageNum is from 0..n-th value.
If the FaxObject type is REGTYPE_BINARYFILE, the valid Type only
IMT_BFTOBJ
IMT_MEM_DIRECT
IMT_FILE_DIRECT
The BITIFF.DLL and the IMAGE32.DLL must be located in the same directory where the FAXCPP32.DLL is. If these dlls can not be found, the function will return an error code.
After the SetFaxImagePage function returns, the memory handles, and the memory DIBs passed to this function can be deleted.
Parameters
|
FAXOBJ |
Fax |
Fax port object. |
|
int |
PageNum |
The 0 based n-th page number in the fax object. |
|
TEImageType |
Type |
Specifies the type of image. |
|
TUFaxImage far |
*PageImage |
Pointer to an image structure. |
|
int |
ImageNum |
Specifies which image should be used in a multi-image file(also 0 based). |
Return Value
Returns zero on success, otherwise returns an error code.
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(PutFaxOnQueue(foFax)) {
// Put fax into the queue has failed.
}
} else if(SendFaxNow(pApp->FaxPorts[0], foFax, FALSE)) {
// Sending fax immediate has failed.
}
} else {
// Setting the image page has failed.
}
}
} else {
// No port is opened.
}