📄 uiapi.cpp
字号:
//****************** Copyright 1999 Mobilink Telecom, Inc. *********************
//
// Description: Functions called by the calibration thread to perform specific UI
// tasks. These functions are prototyped to be "C" callable.
//
// $RCSfile: UIapi.cpp $
// $Revision: 1.4 $
// $Date: 1999/06/08 23:45:08 $
// $Author: gdheinz $
//
//******************************** History *************************************
//
// $Log: UIapi.cpp $
// Revision 1.4 1999/06/08 23:45:08 gdheinz
// Add horizontal scroll bars to listboxes and enlarge windows.
// Revision 1.3 1999/06/08 22:10:21 gdheinz
// Added documentation block
//
//******************************************************************************
//
// 9/7/99 nrs Cleaned up trailing newlines in UI_AddSIOLine()
// Cleaned up dangling newlines in strings returned by the Read GPIB function
//
// June 27, 2000
// Replaced chipset_type with PACCalType
//
#include "stdafx.h"
#include "resource.h"
#include "UIapi.h"
//#include "ParamList.h"
#include "MTICalibrateDlg.h"
#include "caltypes.h"
///////////////////////////////////////////////////////////////////////////////
//
// UI_AddGPIBLine
//
// Add a line of text to the GPIB log file. The lines are displayed in
// the sequence that this function is called. Lines may include tab
// characters.
//
///////////////////////////////////////////////////////////////////////////////
void UI_AddGPIBLine ( char* text )
{
HANDLE hFile;
unsigned long fp;
unsigned long count;
char cr[2]={0x0d,0x0a};
hFile=CreateFile("c:gpib_log.txt",GENERIC_WRITE,FILE_SHARE_READ,NULL,
OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
// go to end of file
fp=SetFilePointer (hFile,0,NULL, FILE_END);
WriteFile(hFile,text,strlen(text),&count,NULL);
WriteFile(hFile,cr,2,&count,NULL); // append a newline
CloseHandle(hFile);
}
///////////////////////////////////////////////////////////////////////////////
//
// UI_AddSIOLine
//
// Add a line of text to the SIO log file. The lines are displayed in
// the sequence that this function is called. Lines may include tab
// characters.
//
///////////////////////////////////////////////////////////////////////////////
void UI_AddSIOLine ( char* text )
{
// 9/7/99 nrs
// cleaned up trailing newlines
// 12/9/99 Log all to file
HANDLE hFile;
unsigned long fp;
unsigned long count;
char cr[2]={0x0d,0x0a};
hFile=CreateFile("c:sio_log.txt",GENERIC_WRITE,FILE_SHARE_READ,NULL,
OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
// go to end of file
fp=SetFilePointer (hFile,0,NULL, FILE_END);
WriteFile(hFile,text,strlen(text),&count,NULL);
WriteFile(hFile,cr,2,&count,NULL); // append a newline
CloseHandle(hFile);
}
void UI_GetFileName ( char* text )
{
strcpy ( text, UIF_GetFileName() ) ;
}
void UI_GetOutputFilename ( char* text )
{
strcpy ( text, (LPCTSTR)UIF_GetOutputFilename() ) ;
}
void UI_GetParamTemplateFilename ( char* text )
{
strcpy ( text, (LPCTSTR)UIF_GetParamTemplateFilename() ) ;
}
void UI_SetStatusBarText ( char* text )
{
UIF_SetStatusBarText(text);
}
TesterType_t UI_GetTesterType(void)
{
return UIF_GetTesterType();
}
PACCalType_t UI_GetPACCalType(void)
{
return UIF_GetPACCalType();
}
///////////////////////////////////////////////////////////////////////////////
//
// UI_Sleep
//
// Suspends calling thread for the specified number of milliseconds.
//
///////////////////////////////////////////////////////////////////////////////
void UI_Sleep ( long milliseconds )
{
Sleep ( milliseconds ) ;
}
///////////////////////////////////////////////////////////////////////////////
//
// UI_IsAbort
//
// Returns true is the Abort button in the UI has been hit. This should
// be polled frequently by the calibration thread so that the interface
// remains responsive to the Abort button.
//
///////////////////////////////////////////////////////////////////////////////
long UI_IsAbort ( void )
{
unsigned stat;
stat=::UIF_IsAbort ( ) ;
::UIF_ClearAbort();
return stat;
}
unsigned UI_Error ( char* str )
{
char new_str[256];
unsigned stat;
strcpy(new_str,str);
strcat(new_str,"\nContinue?");
stat=AfxMessageBox ( new_str, MB_YESNO|MB_ICONWARNING ) ;
return stat;
}
void UI_ErrorQuit ( char* str )
{
AfxMessageBox ( str, MB_OK|MB_ICONWARNING ) ;
}
void UI_Msg ( char* str )
{
AfxMessageBox ( str, MB_OK|MB_ICONWARNING ) ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -