?? display.c
字號:
#include <windows.h>
#include <stdio.h>
#include <errno.h>
#include <srllib.h>
#include <dxxxlib.h>
#include "inter.h"
extern FILE *fp;
extern int maxchans;
extern char gRowVal[NUM_ROWS][MAX_STR_LEN];
extern DX_INFO Dxinfo[ MAXCHANS ];
char version[] = "2.00";
char dialogic[] = "Dialogic Win NT D/xxx";
char dialogic2[] = "Multi-Threaded Demonstration Program";
/***************************************************************************
* NAME: disp_init(hwnd )
* INPUTS: none
* DESCRIPTION: Initialize display for this program
*************************************************************************/
void disp_init
(HWND hwnd)
{
RECT rect;
// get the entire window rectangle
GetClientRect(hwnd, &rect);
// calculate the rectangle coordinates
rect.bottom=rect.top + 3*ROW_HEIGHT;
strcpy(gRowVal[0], dialogic);
sprintf(gRowVal[1], "%s", dialogic2);
strcpy(gRowVal[2], "(c) Dialogic Corporation, 1992-97");
InvalidateRect(hwnd, &rect, TRUE); // see note at front of "display.h"
UpdateWindow(hwnd);
}
/***************************************************************************
* NAME: disp_status(hwnd, chnum, stringp)
* INPUTS: chno - channel number (1 - 12)
* stringp - pointer to string to display
* DESCRIPTION: display the current activity on the channel in window 2
* (the string pointed to by stringp) using chno as a Y offset
*************************************************************************/
void disp_status
(HWND hwnd,
int chnum,
char *stringp)
{
RECT rect;
// get the entire window rectangle
GetClientRect(hwnd, &rect);
sprintf(gRowVal[CHAN_BASE_ROW + chnum - 1],
"Channel %d, Name=%s---> %s", chnum, Dxinfo[ chnum - 1 ].dev_name, stringp);
// calculate the rectangle coordinates
rect.top=(chnum+ CHAN_BASE_ROW) * ROW_HEIGHT ;
rect.bottom=rect.top+ROW_HEIGHT;
InvalidateRect(hwnd, &rect, TRUE);
UpdateWindow(hwnd);
}
/***************************************************************************
* NAME: disp_msg(hwnd, stringp)
* INPUTS: stringp - pointer to string to display.
* DESCRIPTION: display the string passed, in the primary message area of
* window
*************************************************************************/
void disp_msg
(HWND hwnd,
char *stringp)
{
RECT rect;
OutputDebugString( stringp ); OutputDebugString( "\n" );
// fputs( stringp, fp ); fputs( "\n", fp );
// get the entire window rectangle
GetClientRect(hwnd, &rect);
strcpy(gRowVal[CHAN_BASE_ROW-1], stringp); // last row before channel rows
// calculate the rectangle coordinates for the text
rect.top=(CHAN_BASE_ROW) * ROW_HEIGHT ;
rect.bottom=rect.top+ROW_HEIGHT;
InvalidateRect(hwnd, &rect, TRUE);
UpdateWindow(hwnd);
}
/***************************************************************************
* NAME: disp_err(hwnd thr_num, chfd )
* DESCRIPTION: This routine prints error information.
* INPUTS: thr_num - thread number
* chfd - device descriptor
* OUTPUTS: The error code and error message are displayed
* CAUTIONS: none.
************************************************************************/
void disp_err( hwnd, thr_num, chfd )
HWND hwnd;
int thr_num;
int chfd;
{
long lasterr = ATDV_LASTERR( chfd );
char *dev_name = ATDV_NAMEP( chfd ) ;
if ( lasterr == EDX_SYSTEM ) {
PrintError("Thread %d: ERROR: errno %d, Device = %s", thr_num, errno, dev_name );
} else {
PrintError("Thread %d: ERROR: lasterr 0x0%x, Device = %s", thr_num, lasterr, dev_name );
}
}
/***************************************************************************
* NAME: disp_clear(chnum)
* INPUTS: hwnd - main window handle
* DESCRIPTION: clears the status area of the window
*************************************************************************/
void disp_clear (HWND hwnd)
{
RECT rect;
int i;
// get the entire window rectangle and save the right coordinate
GetClientRect(hwnd, &rect);
// calculate the rectangle coordinates
rect.top=(CHAN_BASE_ROW+1) * ROW_HEIGHT ;
rect.bottom=rect.top+((maxchans+1)*ROW_HEIGHT);
for (i=1; i<=maxchans+1; i++)
sprintf(gRowVal[CHAN_BASE_ROW - 1 + i], "");
InvalidateRect(hwnd, &rect, TRUE);
UpdateWindow(hwnd);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -