?? 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; // 傳真質(zhì)量(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應(yīng)答音量( 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]; //發(fā)送者信息
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);
}
/**********************************************************************************
函數(shù)名:<GetModemDeviceList>
----------------------------
功能: 獲得所有可用Modem列標信息
----------------------------
參數(shù):
1: lParam
2: lpfnCallback 回調(diào)函數(shù)
************************************************************************************/
bool GetModemDeviceList( unsigned long lParam, MODEMLISLITNECALLBACK lpfnCallback = ModemListCallbackFunc );
/**********************************************************************************
函數(shù)名:<ErrorCorrectFaxPage>
----------------------------
功能: 修正傳真頁
----------------------------
參數(shù):
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 );
/**********************************************************************************
函數(shù)名:<AbortPort>
----------------------------
功能: 中斷傳真操作!
----------------------------
參數(shù):
1: hFax 傳真對象句柄
************************************************************************************/
int AbortPort(SmartFaxObj *hFax);
/**********************************************************************************
函數(shù)名:<SmartFaxMonitorPort>
----------------------------
功能: 監(jiān)視端口消息!
----------------------------
參數(shù):
1: hFax 傳真對象句柄
2: nPort 端口號
3: hWnd 消息窗口句柄
4: Msg 消息ID (WM_SMARTFAX)
************************************************************************************/
int SmartFaxMonitorPort(SmartFaxObj *hFax ,unsigned char nPort,HWND hWnd,UINT Msg);
/**********************************************************************************
函數(shù)名:<TapiSmartReceiveFax>
----------------------------
功能: 通過TAPI接口接收傳真!
----------------------------
參數(shù):
1: FaxParam 傳真參數(shù) (見SFaxParam定義)
************************************************************************************/
int TapiSmartReceiveFax(SFaxParam *FaxParam);
/**********************************************************************************
函數(shù)名:<_TapiSmartReceiveFax>
----------------------------
功能: 通過TAPI接口接收傳真!
----------------------------
參數(shù):
1: hFax 傳真對象句柄
2: hCall 傳真參數(shù)
3: hline 傳真參數(shù)
4: FileName 傳真文件名
5: Identifi 傳真識別符(一般添入自己的傳真號碼)
6: Volume Modem應(yīng)答音量( 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);
/**********************************************************************************
函數(shù)名:<TapiSmartSendFax>
----------------------------
功能: 通過TAPI接口發(fā)送傳真!
----------------------------
參數(shù):
1: FaxParam 傳真參數(shù) (見SFaxParam定義)
************************************************************************************/
int TapiSmartSendFax(SFaxParam *FaxParam);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -