⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fdemo.h

📁 传真示例
💻 H
字号:

 /********************************************************************
 *                                                                   *
 *   FFFFFFF  DDDDDD   EEEEEEE  M     M   OOOOO            HH   HH   *
 *   FF       DD   DD  EE       MM   MM  OO   OO           HH   HH   *
 *   FF       DD   DD  EE       MMM MMM  OO   OO           HH   HH   *
 *   FFFFF    DD   DD  EEEEE    M MMM M  OO   OO           HHHHHHH   *
 *   FF       DD   DD  EE       M  M  M  OO   OO           HH   HH   *
 *   FF       DD   DD  EE       M     M  OO   OO   ..      HH   HH   *
 *   FF       DDDDDD   EEEEEEE  M     M   OOOOO    ..      HH   HH   *
 *                                                                   *
 *********************************************************************
 * (C)opyright 1996, Dialogic Corp.                                  *
 ********************************************************************/


#define CBWNDEXTRA sizeof(long)		// MDI child extrabytes for storing DevData pointer
#define WINDOWMENUOFS 2
#define WINBUFFSIZE 512					// buffer for status messages
#define MAXFILE 8				
#define MAXFILELEN 256					
#define MAXDIALLEN 20
#define MAXDEVNAMELEN 12
#define MAXHDRLEN 30
#define MAXIDLEN 20
#define MAXFAXBOARDS 32					// maximum number of fax boards supported

// default flags for fx_sendfax() and fx_rcvfax()
#define RXFLAGS EV_ASYNC|DF_PHASEB|DF_PHASED|DF_TIFF
#define TXFLAGS EV_ASYNC|DF_PHASEB|DF_PHASED

// our Windows event that SRL posts to main window when SRL event is available 
#define WM_SRLNOTIFYEVENT WM_USER+0x50

/* int Cls_OnSRLNotifyEvent(HWND hwnd, int evttype, int devhandle) */
#define HANDLE_WM_SRLNOTIFYEVENT(hwnd, wParam, lParam, fn) \
    ((fn)((hwnd), (int)(wParam), (int)(lParam)))
#define FORWARD_WM_SRLNOTIFYEVENT(hwnd, evttype, devhandle, fn) \
    (void)(fn)((hwnd), WM_SRLNOTIFYEVENT, (WPARAM) (evttype), (LPARAM)(devhandle))

// device state information
typedef enum {
   ST_INIT,             // initializing
   ST_WTRING,           // idle, waiting for rings
   ST_RXOFFHK,          // accepting call
   ST_RXRECVFAX,        // receiving a fax
   ST_TXOFFHK,          // going offhook to dial
   ST_TXDIAL,           // dialing number
   ST_TXSENDFAX,        // sendfax active
   ST_ONHK              // going onhook 
} STATE;


// Macro returns active MDI child window, or NULL if error
#define GetMDIActiveChild(hwnd) \
   (HWND) SendMessage(hwnd, WM_MDIGETACTIVE, 0, 0)

// Macros to set/get DEVDATA structure associated with the window
#define GetDevPtr(hwnd) (LPDEVDATA) GetWindowLong((hwnd), 0)
#define SetDevPtr(hwnd, lpdevdata) (DEVDATA*) SetWindowLong((hwnd), 0, (LONG)(lpdevdata))

/************************************************************
 * data structure used for sending faxes
 ************************************************************/
typedef struct  {
   int   count;
   char  filename[MAXFILE][MAXFILELEN];
   DF_IOTT iott[MAXFILE];   
}  SENDFILELIST, *LPSENDFILELIST;

/************************************************************
 * Device status block, allocated for each open device
 ************************************************************/
typedef struct  _devdata {
   int   state;                     // device activity state
   int   voicehandle;
   int   faxhandle;
   HWND  hwnd;
   int   chtype;
   int   rxcount;
   char  devname[MAXDEVNAMELEN];    // device control information
   char  remoteid[21]; 
   char  dialstr[MAXDIALLEN];
   char  rxfilename[14];
   DF_ASCIIDATA asciidata;
   SENDFILELIST sfl;
   char  winbuff[WINBUFFSIZE];      // buffer for window text information
} DEVDATA, *LPDEVDATA; 

/************************************************************
 * Prototypes
 ************************************************************/

// "default" window procedure procs for code clarity
long WINAPI FrameDefProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam);
long WINAPI ChildDefProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam);

// dialog procedures
BOOL WINAPI DevOptsDlgProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam);
BOOL WINAPI ASCIIOptsDlgProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam);
BOOL WINAPI SendDialDlgProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam);
BOOL WINAPI DevOpenDlgProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam);
BOOL WINAPI AboutDlgProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam);

// other functions
char *strtrim(char *pStr);
void SendfaxCleanup(LPDEVDATA lpDevData, int evttype);

HWND OpenFaxDevice(char *pName);
BOOL CloseFaxDevice(HWND hwnd);
HWND AlreadyOpen(char *pName);
BOOL CloseAllChildren(void);
BOOL StopFax(HWND hwnd);
int GetFaxBoards(void);

void GrayMenuItems(void);
void StatusMsg(HWND hwnd, char *szFormat, ...);
int MsgBoxPrintf(HWND hwnd, char *szTitle, UINT fustyle, char *szFormat, ...);
void WinPrintfAt(HDC hdc, int row, int col, LPSTR pszFormat, ... );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -