?? faxcvt.cpp
字號:
#include <windows.h>
#include <commdlg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <wchar.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <mmsystem.h>
#include "FaxCvt.h"
#include "..\\..\\..\\..\\inc\\faxapi32.h"
#define HIGH_RESOLUTION 1
#define STANDARD_RESOLUTION 2
#define A4_LINENO_STANDARD 1100
#define A4_LINENO_HIGH 2200
extern int TotalFaxLine;
extern HWND hGWnd;
//----------
BYTE DotStr[217];
void test(WORD convID);
void AddLine(WORD convID);
void AddHead(WORD convID);
void HandleText(char *str);
void AddTail(WORD convID);
CONVERTSTRUCT* pConv;
int WINAPI FindFreeConvertChannel()
{
for(int i=0;i<TotalFaxLine;i++)
if(pConv[i].LinkNo==-1) return i;
return -1;
}
int WINAPI GetConvIDOfVoiceChannel(int trunkID)
{
for(int i=0;i<TotalFaxLine;i++)
if(pConv[i].LinkNo==trunkID) return i;
return -1;
}
bool WINAPI StartConvert(int trunkID,int convID,char * filename)
{
pConv[convID].LinkNo=trunkID;
int r = DJCvt_Open( convID,filename,HIGH_RESOLUTION, A4_LINENO_HIGH );
if ( r != 1 )
{
printf ( "DJCvt_Open Fail!\n" );
return false;
}
pConv[convID].Step=0;
return true;
}
bool WINAPI CheckConvertEnd(int convID)
{
if(convID<0) return true;
char TmpTextStr[100];
switch(pConv[convID].Step)
{
case 0:
pConv[convID].fp = fopen ( "test.txt", "rt" );
if ( pConv[convID].fp == NULL )
return true;
AddHead(convID);
pConv[convID].TextLine=0;
pConv[convID].Step=1;
case 1:
while ( pConv[convID].TextLine < 120 )
{
if ( feof(pConv[convID].fp) )
{
pConv[convID].Step=2;
break;
}
fgets ( TmpTextStr, 90, pConv[convID].fp );
HandleText(TmpTextStr);
DJCvt_TextLine(convID, TmpTextStr);
pConv[convID].TextLine ++;
if ( DJCvt_LeftLine(convID) < 100 )
{ // should turn to next page
AddTail(convID);
AddHead(convID);
return false;
}
}
pConv[convID].Step=2;
case 2:
AddLine(convID);
DJCvt_TextLineA(0,"How do you do 東進(jìn)公司",0,0,16);
DJCvt_TextLineA(0,"How do you do 東進(jìn)公司",1,0,16);
DJCvt_TextLineA(0,"How do you do 東進(jìn)公司",0,1,16);
DJCvt_TextLineA(0,"How do you do 東進(jìn)公司",1,1,16);
DJCvt_TextLineA(0,"This is demo 東進(jìn)公司",0,0,24);
DJCvt_TextLineA(0,"This is demo 東進(jìn)公司",1,0,24);
DJCvt_TextLineA(0,"This is demo 東進(jìn)公司",0,1,24);
DJCvt_TextLineA(0,"This is demo 東進(jìn)公司",1,1,24);
strcpy ( TmpTextStr, " -- 結(jié)束 --" );
DJCvt_TextLine(convID, TmpTextStr );
strcpy ( TmpTextStr, " " );
DJCvt_TextLine(convID, TmpTextStr );
fclose ( pConv[convID].fp );
return true;
break;
}
return false;
}
void WINAPI StopConvert(int convID)
{
if(convID<0) return;
pConv[convID].LinkNo=-1;
DJCvt_Close(convID);
}
bool WINAPI InitConvert()
{
DJCvt_InitConvert();
pConv=new CONVERTSTRUCT[TotalFaxLine];
for(int i = 0; i < TotalFaxLine; i++)
{
pConv[i].LinkNo=-1;
}
return true;
}
void WINAPI ExitConvert()
{
DJCvt_DisableConvert();
delete pConv;
}
void AddLine(WORD convID)
{
memset ( DotStr+0, 0x00, 10 );
memset ( DotStr+10, 0xff, 196 );
memset ( DotStr+206, 0x00, 10 );
DJCvt_DotLine ( convID, (char *) DotStr, 1728, DOT_0_IS_WHITE );
DJCvt_DotLine ( convID, (char *) DotStr, 1728, DOT_0_IS_WHITE );
DJCvt_DotLine ( convID, (char *) DotStr, 8, DOT_0_IS_WHITE );
DJCvt_DotLine ( convID, (char *) DotStr, 8, DOT_0_IS_WHITE );
}
void AddHead(WORD convID)
{
DJCvt_BmpFile(convID,"test.bmp");
//DJCvt_BmpFileA(convID,"test.bmp", 0);
AddLine(convID);
}
void AddTail(WORD convID)
{
DotStr[0] = 0;
for ( int i = 0; i < 10; i ++ )
DJCvt_DotLine ( convID, (char *) DotStr, 8, DOT_0_IS_WHITE );
AddLine(convID);
for ( i = 0; i < 90; i ++ )
DJCvt_DotLine ( convID, (char *) DotStr, 8, DOT_0_IS_WHITE );
}
void HandleText(char *str)
{
int EndPos = strlen(str);
if ( ( str[EndPos-1] == 0x0d ) || ( str[EndPos-1] == 0x0a ) )
str[EndPos-1] = ' ';
if ( EndPos > 1 ) {
if ( ( str[EndPos-2] == 0x0d ) || ( str[EndPos-2] == 0x0a ) )
str[EndPos-2] = ' ';
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -