📄 smarfaxh.h
字号:
#ifndef __SMARTFAX_H_
#define __SMARTFAX_H_
#include <tapi.h>
#include <windows.h>
/*
#ifdef __cplusplus
extern "C" {
#endif
*/
typedef HANDLE SmartFaxObj;
enum EResolution
{
RE_FINE,
RE_STANDARD
};
enum EClass
{
CLASS_1,
CLASS_2
};
enum EErrorCorrect
{
ECM_DISABLE,
ECM_ENABLE
};
enum EBinaryFile
{
BFT_DISABLE,
BFT_ENABLE
};
enum ECreateHead
{
CH_DISABLE,
CH_ENABLE
};
enum EUsed2D
{
U2D_DISABLE,
U2D_ENABLE
};
enum EFaxSpeed
{
FS_2400,
FS_4800,
FS_7200,
FS_9600,
FS_1200,
FS_1440,
};
enum EVolume
{
VO_OFF,
VO_LOW,
VO_MIDDLE,
VO_HIGH
};
typedef struct tag_SFaxParam
{
HCALL hCall;
HLINE hLine;
EResolution Resolution; // 传真质量(RE_FINE | RE_STARDARD)
unsigned char nComPort ; // 端口号(1 - 256 )
EFaxSpeed Speed; //传真速度 ( 24 | 48 | 72 | 96 | 120 |144)
EUsed2D Is2D; //压缩方式(U2D_ENABLE | U2D_DISABLE)
EClass Class; //传真类型(CLASS_1 | CLASS_2 | CLASS_1.0 | CLASS_2.0)
EVolume Volume; //Modem应答音量( 0 | 1 | 2 | 3 )
char FileName[MAX_PATH]; //传真文件名
char Identifi[56]; //传真识别符(一般添入自己的传真号码)
EErrorCorrect Ecm; //纠错方式(ECM_ENABLE | ECM_DISABLE )
HWND Hwnd; // 消息窗口句柄
UINT Msg; //消息ID (WM_SMARTFAX)
SmartFaxObj *hFax; //传真对象句柄
// send extrac parameter
char FaxNumber[21]; //传真号码
char From[128]; //发送者信息
char To[128]; //接受者信息
ECreateHead CreateHead; //建立传真页眉信息( CH_DISABLE | CH_ENABLE)
EBinaryFile BinaryFile; //两进制文件传输(BFT_DISABLE | BFT_ENABLE )
int nStartPage; //开始页
#if defined(__cplusplus) && !defined(__BORLANDC__)
//EXPDEF SFaxParam();
#endif
}SFaxParam;
const unsigned short D1DMR = 0; // 1-D Modified Huffman
const unsigned short D2DMR = 1; // 2-D Modified Huffman
const unsigned short D2DMMR = 3; // 2-D Modified Modified Read
typedef void (CALLBACK * MODEMLISLITNECALLBACK)(DWORD dwDeviceId, const char *sLineName, const char *ComPort,unsigned long lParam);
static void CALLBACK ModemListCallbackFunc(DWORD dwDeviceId, const char *sLineName, const char *ComPort,unsigned long lParam);
static void CALLBACK ModemListCallbackFunc(DWORD dwDevice, const char *sLineName, const char *ComPort,unsigned long lParam)
{
fprintf(stderr,"DeviceID: %d \nLineName: %s\nCommPort: %s \n",dwDevice,sLineName,ComPort);
}
/**********************************************************************************
函数名:<GetModemDeviceList>
----------------------------
功能: 获得所有可用Modem列标信息
----------------------------
参数:
1: lParam
2: lpfnCallback 回调函数
************************************************************************************/
bool GetModemDeviceList( unsigned long lParam, MODEMLISLITNECALLBACK lpfnCallback = ModemListCallbackFunc );
/**********************************************************************************
函数名:<ErrorCorrectFaxPage>
----------------------------
功能: 修正传真页
----------------------------
参数:
1: Input 输入文件名
2: Output 输出文件名
3: CompressionDF 压缩方式
************************************************************************************/
int ErrorCorrectFaxPage(const char *Input,const char*Output,unsigned short CompressionDF = D2DMMR);
long InitFaxTapiCall(HLINE &hLine,HCALL &hCall);
int ModemGetComPort( const char* strName );
/**********************************************************************************
函数名:<AbortPort>
----------------------------
功能: 中断传真操作!
----------------------------
参数:
1: hFax 传真对象句柄
************************************************************************************/
int AbortPort(SmartFaxObj *hFax);
/**********************************************************************************
函数名:<SmartFaxMonitorPort>
----------------------------
功能: 监视端口消息!
----------------------------
参数:
1: hFax 传真对象句柄
2: nPort 端口号
3: hWnd 消息窗口句柄
4: Msg 消息ID (WM_SMARTFAX)
************************************************************************************/
int SmartFaxMonitorPort(SmartFaxObj *hFax ,unsigned char nPort,HWND hWnd,UINT Msg);
/**********************************************************************************
函数名:<TapiSmartReceiveFax>
----------------------------
功能: 通过TAPI接口接收传真!
----------------------------
参数:
1: FaxParam 传真参数 (见SFaxParam定义)
************************************************************************************/
int TapiSmartReceiveFax(SFaxParam *FaxParam);
/**********************************************************************************
函数名:<_TapiSmartReceiveFax>
----------------------------
功能: 通过TAPI接口接收传真!
----------------------------
参数:
1: hFax 传真对象句柄
2: hCall 传真参数
3: hline 传真参数
4: FileName 传真文件名
5: Identifi 传真识别符(一般添入自己的传真号码)
6: Volume Modem应答音量( 0 | 1 | 2 | 3 )
7: Speed 传真需要的速度( 24 | 48 | 72 | 96 | 120 |144)
8: Class 传真类型(CLASS_1 | CLASS_2 | CLASS_1.0 | CLASS_2.0)
9: Is2d 压缩方式(U2D_ENABLE | U2D_DISABLE)
10: ECM 纠错方式(ECM_ENABLE | ECM_DISABLE )
11: hWnd 消息窗口句柄
1: Msg 消息ID (WM_SMARTFAX)
返回值:
0: End if function completes successfully
-1: Exception error
101: Failed to Open FAX file ~
102: Couldn't conneced within 35 secs of ATA command
103: Resevr
104: Failed to send CSI frames
105: Failed to send DIS frames
106: Failed to send NFS frames
107: Failed to send other negotiating frames
108: Failed to send CFR frames
109: Failed to training
110: Failed to send FTT frames
111: Failed to set training speed 3 times
112: Failed to send CRP frames
113: Failed to dropped carrier within 5 s
114: Failed to respond to +FRM properly
115: Failed to get modem data
116: Failed to accept page data
201: Couldn't be found transmit file
202: Transmit file isn't TIFF CLASS
203: Call isn't answered within 30 s
204: Machine can't receive fax data
205: Couldn't set +FTM
206: Couldn't set +FTM
210: NO DIALTONE
211: BUSY
212: NO ANSWER
213: NO CARRIER
************************************************************************************/
int _TapiSmartReceiveFax(SmartFaxObj *hFax ,HCALL &hCall,HLINE &hline,const char *FileName, \
const char *Identifi,EVolume Volume ,EFaxSpeed Speed,\
EClass Class,EUsed2D Is2d,EErrorCorrect ECM,HWND hWnd,UINT Msg);
/**********************************************************************************
函数名:<TapiSmartSendFax>
----------------------------
功能: 通过TAPI接口发送传真!
----------------------------
参数:
1: FaxParam 传真参数 (见SFaxParam定义)
************************************************************************************/
int TapiSmartSendFax(SFaxParam *FaxParam);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -