?? faxapi.cpp
字號:
{
CModem* pMdm = FaxApiGetModem( pModem );
if( pMdm == NULL )
{
return FAXAPI_ERROR_BAD_MODEM;
}
if( pMdm->ThreadStarted() )
{
// can't change the port once the thread is started.
return FAXAPI_ERROR_THREAD_STARTED;
}
pMdm->SetSendECM( bECMSupported );
return FAXAPI_SUCCESS;
}
//////////////////////////////////////////////////////////////////////
// FaxApiSetSendFine
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiSetSendFine( FaxApiModem pModem, bool bFineSupported )
{
CModem* pMdm = FaxApiGetModem( pModem );
if( pMdm == NULL )
{
return FAXAPI_ERROR_BAD_MODEM;
}
if( pMdm->ThreadStarted() )
{
// can't change the port once the thread is started.
return FAXAPI_ERROR_THREAD_STARTED;
}
pMdm->SetSendFine( bFineSupported );
return FAXAPI_SUCCESS;
}
//////////////////////////////////////////////////////////////////////
// FaxApiSetSendUnlimited
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiSetSendUnlimited( FaxApiModem pModem, bool bUnlimitedSupported )
{
CModem* pMdm = FaxApiGetModem( pModem );
if( pMdm == NULL )
{
return FAXAPI_ERROR_BAD_MODEM;
}
if( pMdm->ThreadStarted() )
{
// can't change the port once the thread is started.
return FAXAPI_ERROR_THREAD_STARTED;
}
pMdm->SetSendUnlimited( bUnlimitedSupported );
return FAXAPI_SUCCESS;
}
//////////////////////////////////////////////////////////////////////
// FaxApiSetPulseDialing
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiSetPulseDialing( FaxApiModem pModem, bool bPulseDialing )
{
CModem* pMdm = FaxApiGetModem( pModem );
if( pMdm == NULL )
{
return FAXAPI_ERROR_BAD_MODEM;
}
if( pMdm->ThreadStarted() )
{
// can't change the port once the thread is started.
return FAXAPI_ERROR_THREAD_STARTED;
}
pMdm->SetPulseDialing( bPulseDialing );
return FAXAPI_SUCCESS;
}
//////////////////////////////////////////////////////////////////////
// FaxApiEnableDebugLog
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiEnableDebugLog( FaxApiModem pModem, bool bEnable, char* LogDirectory )
{
CModem* pMdm = FaxApiGetModem( pModem );
if( pMdm == NULL )
{
return FAXAPI_ERROR_BAD_MODEM;
}
if( pMdm->ThreadStarted() )
{
// can't change the port once the thread is started.
return FAXAPI_ERROR_THREAD_STARTED;
}
pMdm->EnableDebugLog( bEnable, LogDirectory );
return FAXAPI_SUCCESS;
}
//////////////////////////////////////////////////////////////////////
// FaxApiEnableDebugLog
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiSetMaxPageRetries( FaxApiModem pModem, int nRetries )
{
CModem* pMdm = FaxApiGetModem( pModem );
if( pMdm == NULL )
{
return FAXAPI_ERROR_BAD_MODEM;
}
if( pMdm->ThreadStarted() )
{
// can't change the port once the thread is started.
return FAXAPI_ERROR_THREAD_STARTED;
}
pMdm->SetMaxPageRetries( nRetries );
return FAXAPI_SUCCESS;
}
//////////////////////////////////////////////////////////////////////
// FaxApiSetCSID
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiSetCSID( FaxApiModem pModem, LPCSTR szString )
{
CModem* pMdm = FaxApiGetModem( pModem );
if( pMdm == NULL )
{
return FAXAPI_ERROR_BAD_MODEM;
}
if( pMdm->ThreadStarted() )
{
pMdm->ChangeCSID( szString );
return FAXAPI_SUCCESS;
}
pMdm->SetCSID( szString );
return FAXAPI_SUCCESS;
}
//////////////////////////////////////////////////////////////////////
// FaxApiSetSendBaud
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiSetSendBaud( FaxApiModem pModem, int nBaud )
{
CModem* pMdm = FaxApiGetModem( pModem );
if( pMdm == NULL )
{
return FAXAPI_ERROR_BAD_MODEM;
}
if( pMdm->ThreadStarted() )
{
// can't change the port once the thread is started.
return FAXAPI_ERROR_THREAD_STARTED;
}
pMdm->SetSendBaud( nBaud );
return FAXAPI_SUCCESS;
}
//////////////////////////////////////////////////////////////////////
// FaxApiSetRecvBaud
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiSetRecvBaud( FaxApiModem pModem, int nBaud )
{
CModem* pMdm = FaxApiGetModem( pModem );
if( pMdm == NULL )
{
return FAXAPI_ERROR_BAD_MODEM;
}
if( pMdm->ThreadStarted() )
{
// can't change the port once the thread is started.
return FAXAPI_ERROR_THREAD_STARTED;
}
pMdm->SetRecvBaud( nBaud );
return FAXAPI_SUCCESS;
}
//////////////////////////////////////////////////////////////////////
// FaxApiStartThread
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiStartThread( FaxApiModem pModem, HANDLE hStop, DWORD faxThreadID )
{
CModem* pMdm = FaxApiGetModem( pModem );
if( pMdm == NULL )
{
return FAXAPI_ERROR_BAD_MODEM;
}
if( pMdm->ThreadStarted() )
{
// can't change the port once the thread is started.
return FAXAPI_ERROR_THREAD_STARTED;
}
pMdm->Initialize( hStop, faxThreadID );
return FAXAPI_SUCCESS;
}
//////////////////////////////////////////////////////////////////////
// FaxApiWaitForModemToExit
//////////////////////////////////////////////////////////////////////
int FAXAPI_CALL FaxApiWaitForModemToExit( FaxApiModem pModem )
{
CModem* pMdm = FaxApiGetModem( pModem );
if( pMdm == NULL )
{
return FAXAPI_ERROR_BAD_MODEM;
}
if( pMdm->ThreadStarted() == false)
{
// can't wait for the modem if isn't started
return FAXAPI_ERROR_THREAD_STARTED;
}
DWORD dwResult = WaitForSingleObject( pMdm->GetHandle(), 5000 );
if( dwResult == WAIT_OBJECT_0 )
{
return FAXAPI_SUCCESS;
}
else
{
return FAXAPI_ERROR_BAD_MODEM;
}
}
//////////////////////////////////////////////////////////////////////
// FaxApiSendFax
//////////////////////////////////////////////////////////////////////
bool FAXAPI_CALL FaxApiSendFax( FaxApiModem pModem, char* szNumberToDial, char* szFaxFile )
{
CModem* pMdm = FaxApiGetModem( pModem );
if( pMdm == NULL )
{
return false;
}
if( pMdm->ThreadStarted() == false)
{
// can't wait for the modem if isn't started
return false;
}
return pMdm->SendFax( szNumberToDial, szFaxFile );
}
//////////////////////////////////////////////////////////////////////
// FaxApiReceiveFax
//////////////////////////////////////////////////////////////////////
void FAXAPI_CALL FaxApiReceiveFax( FaxApiModem pModem, char* szFaxFile )
{
CModem* pMdm = FaxApiGetModem( pModem );
if( pMdm == NULL )
{
return;
}
if( pMdm->ThreadStarted() == false)
{
// can't wait for the modem if isn't started
return;
}
pMdm->RecvFax( szFaxFile );
}
//////////////////////////////////////////////////////////////////////
// FaxApiAbortFax
//////////////////////////////////////////////////////////////////////
void FAXAPI_CALL FaxApiAbortFax( FaxApiModem pModem )
{
CModem* pMdm = FaxApiGetModem( pModem );
if( pMdm == NULL )
{
return;
}
if( pMdm->ThreadStarted() == false)
{
// can't abort fax if the modem isn't started
return;
}
pMdm->AbortFax();
}
//////////////////////////////////////////////////////////////////////
// FaxApiDisconnect
//////////////////////////////////////////////////////////////////////
void FAXAPI_CALL FaxApiDisconnect( FaxApiModem pModem )
{
CModem* pMdm = FaxApiGetModem( pModem );
if( pMdm == NULL )
{
return;
}
if( pMdm->ThreadStarted() == false)
{
// can't abort fax if the modem isn't started
return;
}
pMdm->Disconnect();
}
//////////////////////////////////////////////////////////////////////
// FaxApiClearRingCount
//////////////////////////////////////////////////////////////////////
void FAXAPI_CALL FaxApiClearRingCount( FaxApiModem pModem )
{
CModem* pMdm = FaxApiGetModem( pModem );
if( pMdm == NULL )
{
return;
}
if( pMdm->ThreadStarted() == false)
{
return;
}
pMdm->ClearRingCount();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -