www.pudn.com > dialogic_IVR.rar > PANSRMTCDLG.CPP
// PansrMTCDlg.cpp : implementation file
//
#include "stdafx.h"
#include "PansrMTC.h"
#include "PansrMTCDlg.h"
#include "SettingDialog.h"
#include "SimuPhone.h"
#include "process.h"
#include "SourceMonitor.h"
#include "ServiceDataQueue.h"
#include "ServiceBroker.h"
#include "VSInterpreter.h"
extern UINT VSInterpreterThread(LPVOID pParam);
#ifdef _DEBUG
#if 0
#define new DEBUG_NEW
#endif
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/* Defaults for channel parameters
*/
#define DEF_D4XBDNUM 1 /* Default D/4x Board Number to Start use */
#define DEF_DTIBDNUM 1 /* Default DTI Board Number to Start use */
#define DEF_FRONTEND CT_NTANALOG /* Default network frontend is ANALOG */
#define DEF_SCBUS TRUE /* Default Bus mode is SCbus */
#define DEF_ROUTEAG FALSE /* Route analog frontend to resource ??? */
#define DEF_BOARDTAG TRUE /* Default type is CCM */
#define DEF_MAXCHANS 2 /* Default Number of D/4x Channels to use */
BOOL m_bRunning2=FALSE;
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPansrMTCDlg dialog
CPansrMTCDlg::CPansrMTCDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPansrMTCDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPansrMTCDlg)
m_d4xbdnum = 0;
m_dtibdnum = 0;
m_maxchans = 0;
m_scbus = FALSE;
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_state = DLGC_STOPPED_ST;
if ((ghDLGCEvent = CreateEvent(
NULL, // pointer to security attributes, we use default
FALSE, // flag for manual reset event, we choose auto-reset
FALSE, // flag for initial state, we choose unsignalled
NULL) // pointer to event-object name, we choose no name
) == NULL)// failure
{
AfxMessageBox("ghDLGCEvent = CreateEvent failed",
MB_ICONEXCLAMATION);
}
InitDialogic();
m_maxchans = DEF_MAXCHANS;
m_d4xbdnum = DEF_D4XBDNUM;
m_dtibdnum = DEF_DTIBDNUM;
m_frontend = DEF_FRONTEND;
m_maxchans = GetPrivateProfileInt("CHANNEL", "MAXCHANS", 4, ".\\Setup.ini" );
m_frontend = GetPrivateProfileInt("CHANNEL", "FRONTEND", 2, ".\\Setup.ini" );
char faxtype[12] = "";
GetPrivateProfileString("CHANNEL", "FAXRES", "VFAX",faxtype,12, ".\\Setup.ini" );
if( strcmp( faxtype, "GFAX" ) == 0 ) gammfax = 1;
else gammfax = 0;
if( !gammfax )
{
faxchans = GetPrivateProfileInt("VFAX", "FAXCHANS", 0, ".\\Setup.ini" );
faxbdnum = GetPrivateProfileInt("VFAX", "FAXBDNUM", 0, ".\\Setup.ini" );
}
else
{
faxchans = GetPrivateProfileInt("GFAX", "FAXCHANS", 0, ".\\Setup.ini" );
faxbdnum = GetPrivateProfileInt("GFAX", "FAXBDNUM", 0, ".\\Setup.ini" );
}
m_analog = (m_frontend == CT_NTANALOG);
m_e1 = (m_frontend == CT_NTE1);
m_t1 = (m_frontend == CT_NTT1);
m_scbus = DEF_SCBUS;
}
void CPansrMTCDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPansrMTCDlg)
DDX_Control(pDX, ID_SETTING, m_setting);
DDX_Control(pDX, IDC_DTI, m_static_dti);
DDX_Control(pDX, IDC_NUM_CHAN, m_static_num_chan);
DDX_Control(pDX, IDC_FRONTEND, m_static_frontend);
DDX_Control(pDX, IDC_EDIT_NUM_CHAN, m_edit_num_chan);
DDX_Control(pDX, IDC_EDIT_DTI, m_edit_dti);
DDX_Control(pDX, IDC_EDIT_D4x, m_edit_d4x);
DDX_Control(pDX, IDC_D4X, m_static_d4x);
DDX_Control(pDX, IDC_CHECK_PEB, m_button_peb);
DDX_Control(pDX, IDC_DLGC_BUTTON, m_dlgc_button);
DDX_Text(pDX, IDC_EDIT_D4x, m_d4xbdnum);
DDV_MinMaxInt(pDX, m_d4xbdnum, 1, 32);
DDX_Text(pDX, IDC_EDIT_DTI, m_dtibdnum);
DDV_MinMaxInt(pDX, m_dtibdnum, 1, 32);
DDX_Text(pDX, IDC_EDIT_NUM_CHAN, m_maxchans);
DDV_MinMaxInt(pDX, m_maxchans, 1, MAXCHANS); // manually editted
DDX_Check(pDX, IDC_CHECK_PEB, m_scbus);
//}}AFX_DATA_MAP
DDX_Check(pDX, IDC_RADIO_ANALOG, m_analog);
DDX_Check(pDX, IDC_RADIO_E1, m_e1);
DDX_Check(pDX, IDC_RADIO_T1, m_t1);
DDX_Control(pDX, IDC_RADIO_ANALOG, m_button_analog);
DDX_Control(pDX, IDC_RADIO_E1, m_button_e1);
DDX_Control(pDX, IDC_RADIO_T1, m_button_t1);
}
BEGIN_MESSAGE_MAP(CPansrMTCDlg, CDialog)
//{{AFX_MSG_MAP(CPansrMTCDlg)
ON_WM_SYSCOMMAND()
ON_WM_DESTROY()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_DLGC_BUTTON, OnDlgcButton)
ON_WM_CLOSE()
ON_BN_CLICKED(ID_HELP_INDEX, OnHelpIndex)
ON_BN_CLICKED(ID_SETTING, OnSetting)
ON_WM_TIMER()
ON_BN_CLICKED(IDC_BUTTON_COMPILE, OnButtonCompile)
ON_BN_CLICKED(IDC_BUTTON_SIMUPHONE, OnButtonSimuphone)
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_RADIO_ANALOG, OnRadioAnalog)
ON_BN_CLICKED(IDC_RADIO_E1, OnRadioAnalog)
ON_BN_CLICKED(IDC_RADIO_T1, OnRadioAnalog)
ON_MESSAGE(WM_DLGC_STOPPED, OnDialogicStopped)
ON_MESSAGE(WM_DLGC_STATE, OnDialogicState)
ON_MESSAGE(WM_DLGC_CODE, OnDialogicCode)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPansrMTCDlg message handlers
BOOL CPansrMTCDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
SetTimer(1, 60000, NULL); //延时启动,为自动重启的需要
GetClientRect(&m_default_client_rect);
m_dlgc_button.SetWindowText(DLGC_START_STR);
OnRadioAnalog();
return TRUE; // return TRUE unless you set the focus to a control
}
void CPansrMTCDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
void CPansrMTCDlg::OnDestroy()
{
WinHelp(0L, HELP_QUIT);
CDialog::OnDestroy();
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CPansrMTCDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CPansrMTCDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
int RunVSInterpreter(int iMaxChannel)
{
struct VSInterpreterThreadParam *pvsInterpreter;
pvsInterpreter = (struct VSInterpreterThreadParam *)malloc(sizeof(VSInterpreterThreadParam));
memset( (char *)pvsInterpreter, 0x0, sizeof(VSInterpreterThreadParam) );
pvsInterpreter->iChannelCount = iMaxChannel;
strcpy(pvsInterpreter->aszInstructionFileName, VScript);
AfxBeginThread( VSInterpreterThread,(LPVOID)pvsInterpreter );
Sleep(500); //等待CONSOLE创建完毕
return 0;
}
void CPansrMTCDlg::OnDlgcButton(void)
{
m_bRunning2 = TRUE;
::EnableWindow(::GetDlgItem(this->m_hWnd, IDC_BUTTON_SIMUPHONE), FALSE);
//显示程序开始运行时间
time_t ltime;
time(<ime);
HWND hwndEdit_StartTime = ::GetDlgItem(this->m_hWnd, IDC_EDIT_STARTTIME);
char *szStartTime = ctime(<ime);
szStartTime[strlen(szStartTime) - 1] = 0; //Remove the last char(0x0a)
::SendMessage(hwndEdit_StartTime, WM_SETTEXT, 0, (LPARAM)szStartTime);
switch (m_state)
{
case DLGC_STARTED_ST:
//XYW modified at 2000/11/27
SendMessage(WM_CLOSE);
/*
m_dlgc_button.EnableWindow(FALSE);
m_dlgc_button.SetWindowText(DLGC_STOPPING_STR);
EnableConfiguration(TRUE);
m_setting.EnableWindow(TRUE);
if (!SetEvent(ghDLGCEvent)) // unsuccessful
{
MessageBox("Set event failed in OnDlgcButton", "error",
MB_ICONEXCLAMATION);
}
*/
break;
case DLGC_STOPPED_ST:
m_setting.EnableWindow(FALSE);
if (!ResetEvent(ghDLGCEvent)) // make sure ghDLGCEvent is unsignalled
{
MessageBox("Reset event failed in OnDlgcButton", "Error",
MB_ICONEXCLAMATION);
}
EnableConfiguration(FALSE); // disable our config buttons
if (!UpdateData(TRUE)) // load data back into our variables
{ // must have had a problem with some value.
EnableConfiguration(TRUE);
}
else // data ok
{ // put data in the args struct so we can send it to Dialogic code
m_args.hWnd = m_hWnd;
m_args.maxchans = m_maxchans;
m_args.d4xbdnum = m_d4xbdnum;
m_args.dtibdnum = m_dtibdnum;
m_args.faxbdnum = faxbdnum;
m_args.faxchans = faxchans;
m_args.msibdnum = 0;
m_args.msichans = 0;
if (m_analog) m_frontend = CT_NTANALOG;
else if (m_e1) m_frontend = CT_NTE1;
else if (m_t1) m_frontend = CT_NTT1;
else MessageBox("Invalid m_frontend value", "Error", MB_ICONEXCLAMATION);
m_args.frontend = m_frontend;
m_args.scbus = m_scbus;
m_args.routeag = m_scbus;
m_args.boardtag = DEF_BOARDTAG;
// provide graphical area to show channels' status
AddChannelDialogs();
RunVSInterpreter(m_maxchans);
if (!AfxBeginThread(RunDialogic,(LPVOID)&m_args))
{
MessageBox("AfxBeginThread failed.", "error", MB_ICONEXCLAMATION);
}
else
{
m_state = DLGC_STARTED_ST;
m_dlgc_button.SetWindowText(DLGC_STOP_STR);
}
} // end of if (!UpdateData(...))
break;
default:
MessageBox("CPansrMTCDlg::OnDlgcButton default case.");
break;
}
}
LRESULT CPansrMTCDlg::OnDialogicStopped
(WPARAM wpar,
LPARAM lpar) // must have arguments in order to use ON_MESSAGE
{
switch (m_state)
{
case DLGC_STARTED_ST:
EnableConfiguration(TRUE);
RemoveChannelDialogs();
m_state = DLGC_STOPPED_ST;
m_dlgc_button.SetWindowText(DLGC_START_STR);
m_dlgc_button.EnableWindow(TRUE);
break;
case CLOSING_ST: // Dialogic stopped as a result of closing dialog
EndDialog(CLOSING_ST);
break;
default:
MessageBox("CPansrMTCDlg::OnDialogicStopped default case.");
break;
}
return 0L;
}
CPansrMTCDlg::~CPansrMTCDlg()
{
CloseHandle(ghDLGCEvent);
}
LRESULT CPansrMTCDlg::OnDialogicState
(WPARAM chanNum,
LPARAM state)
{
return m_chan_status_ptr[chanNum - 1]->SendMessage(WM_DLGC_STATE, chanNum, state);
}
LRESULT CPansrMTCDlg::OnDialogicCode
(WPARAM chanNum,
LPARAM code)
{
return m_chan_status_ptr[chanNum - 1]->SendMessage(WM_DLGC_CODE, chanNum, code);
}
void CPansrMTCDlg::EnableConfiguration
(BOOL enable)
{
m_button_analog.EnableWindow(enable);
m_button_e1.EnableWindow(enable);
m_button_t1.EnableWindow(enable);
m_edit_d4x.EnableWindow(enable);
m_edit_num_chan.EnableWindow(enable);
m_static_d4x.EnableWindow(enable);
m_static_frontend.EnableWindow(enable);
m_static_num_chan.EnableWindow(enable);
if (enable)
{
OnRadioAnalog();
}
else
{
m_button_peb.EnableWindow(FALSE);
m_edit_dti.EnableWindow(FALSE);
m_static_dti.EnableWindow(FALSE);
}
}
int CPansrMTCDlg::TryChannelRect
(RECT *chanRect,
RECT *dlgRect, // modified in function
BOOL resizeWidth /* = FALSE */) // should the width of dlgRect be changed if needed
{ // returns positive channelsPerRow if window completely viewable
// returns negative channelsPerRow if window needs further modification
int channelsPerRow;
int chanWidth;
int chanHeight;
CWnd *desktopWnd;
RECT desktopRect;
chanWidth = chanRect->right - chanRect->left;
chanHeight = chanRect->bottom - chanRect->top;
if (m_default_client_rect.right > chanWidth)
{ // the Client width is greater than channel width
// dlgRect->right is already good.
channelsPerRow = m_default_client_rect.right / chanWidth;
dlgRect->bottom += chanHeight * ((m_maxchans - 1) / channelsPerRow + 1);
}
else
{
dlgRect->bottom += chanHeight * m_maxchans;
dlgRect->right += chanWidth - m_default_client_rect.right;
channelsPerRow = 1;
}
// now we make sure we show our window as best as we can.
// I don't want to move what we have unless I have to.
// In other words, if the new window will be completely visible,
// don't move it at all.
desktopWnd = GetDesktopWindow();
desktopWnd->GetClientRect(&desktopRect);
if ((dlgRect->bottom > desktopRect.bottom)
|| (dlgRect->top < desktopRect.top)
|| (dlgRect->right > desktopRect.right)
|| (dlgRect->left < desktopRect.left))
{ // Center the window
dlgRect->bottom -= dlgRect->top;
dlgRect->top = 0;
dlgRect->right -= dlgRect->left;
dlgRect->left = 0;
if (resizeWidth) // expand width of dialog
{
while ((dlgRect->bottom > desktopRect.bottom) // too tall
&& (dlgRect->right < desktopRect.right)) // not too wide
{
channelsPerRow++;
dlgRect->right += chanWidth;
// adding the new correction to dlgRect->bottom and subtracting the old
// dlgRect->bottom += chanHeight * ((m_maxchans - 1) / channelsPerRow + 1)
// - chanHeight * ((m_maxchans - 1) / (channelsPerRow - 1) + 1);
// and now the simplified version:
dlgRect->bottom += chanHeight * ((m_maxchans - 1) / channelsPerRow
- (m_maxchans - 1) / (channelsPerRow - 1));
}
// we don't deal with shrinking width, because that means shrinking the
// width of our main dialog, which better already fit on the screen!
}
if ((dlgRect->bottom > desktopRect.bottom) // dimensions too large
|| (dlgRect->right > desktopRect.right))
{
channelsPerRow *= -1;
}
dlgRect->top = (desktopRect.bottom - dlgRect->bottom) / 2;
dlgRect->bottom += dlgRect->top;
dlgRect->left = (desktopRect.right - dlgRect->right) / 2;
dlgRect->right += dlgRect->left;
}
else // dlgRect is in OK position
{ // do nothing
}
return channelsPerRow;
}
void CPansrMTCDlg::AddChannelDialogs()
{
int i;
int chanWidth; // individual width and height of channel dialog
int chanHeight;
int x; // x and y determine the position of our new channel dialogs
int y;
int channelsPerRow;
RECT chanRect;
RECT myRect;
RECT clientRect;
// create the dialogs
// guaranteed to have one channel, just Create this so we can get size
m_chan_status_ptr[0] = new CChanStatDialog();
if (!m_chan_status_ptr[0]->Create(1, this)) // Creation unsuccessful
{
MessageBox("Unable to create channel dialog.", "Error", MB_ICONEXCLAMATION);
}
// figure the amount of space needed for these new dialogs
// and add that space to the bottom of our current dialog
m_chan_status_ptr[0]->GetWindowRect(&chanRect);
GetWindowRect(&myRect);
if ((channelsPerRow = TryChannelRect(&chanRect, &myRect)) < 0)
{ // need to use small dialogs
m_chan_status_ptr[0]->DestroyWindow(); // get rid of old
delete m_chan_status_ptr[0];
for (i = 0; i < m_maxchans; i++)
{
m_chan_status_ptr[i] = new CChanStatSmallDialog;
if (!m_chan_status_ptr[i]->Create(i + 1, this))
{
MessageBox("Unable to create small channel dialog.", "Error", MB_ICONEXCLAMATION);
}
}
m_chan_status_ptr[0]->GetWindowRect(&chanRect);
GetWindowRect(&myRect); // needs to be restored
if ((channelsPerRow = TryChannelRect(&chanRect, &myRect, TRUE)) < 0)
{
channelsPerRow *= -1;
MessageBox("Too much dialog to display", "Ignoring", MB_OK);
}
}
else // big dialogs are ok
{
for (i = 1; i < m_maxchans; i++)
{
m_chan_status_ptr[i] = new CChanStatDialog;
if (!m_chan_status_ptr[i]->Create(i + 1, this)) // Creation unsuccessful
{
MessageBox("Unable to create channel dialog.", "Error", MB_ICONEXCLAMATION);
}
}
}
MoveWindow(&myRect); // redraws the window
// using x and y, place our dialogs sequentially below the main dialog
GetClientRect(&clientRect);
chanWidth = chanRect.right - chanRect.left;
chanHeight = chanRect.bottom - chanRect.top;
// if we have less channels than channels per row, center it accordingly
x = (clientRect.right - (chanWidth *
// minimum(m_maxchans, channelsPerRow)
((m_maxchans < channelsPerRow) ? m_maxchans : channelsPerRow)
)) / 2;
y = m_default_client_rect.bottom;
i = 0;
while (i < m_maxchans)
{
if (!m_chan_status_ptr[i]->SetWindowPos(&wndBottom, x, y, 0, 0,
SWP_NOSIZE // do not resize
| SWP_SHOWWINDOW)) // show the window
{
MessageBox("SetWindowPos failed.", "Error", MB_ICONEXCLAMATION);
}
x += chanWidth;
if ((x + chanWidth) > clientRect.right) // can't fit another in
{ // I am a centering FOOL! if our row has less than the channels per row
// center it accordingly.
x = (clientRect.right - (chanWidth *
// minimum(m_maxchans - i - 1, channelsPerRow)
(((m_maxchans - i - 1) < channelsPerRow) ? (m_maxchans - i - 1) : channelsPerRow)
)) / 2;
y += chanHeight;
}
i++;
}
m_dlgc_button.SetActiveWindow(); // so our main dialog is still the active one
}
void CPansrMTCDlg::RemoveChannelDialogs()
{
int i;
RECT myRect;
RECT myClientRect;
// destroy the dialogs
for (i = 0; i < m_maxchans; i++)
{
m_chan_status_ptr[i]->DestroyWindow();
delete m_chan_status_ptr[i];
}
// reset our main dialog's looks
GetWindowRect(&myRect);
GetClientRect(&myClientRect);
// using the default client rect we established on initializiation,
// set our size to what it would have been without the channel
// dialogs
myRect.right += m_default_client_rect.right - myClientRect.right;
myRect.bottom += m_default_client_rect.bottom - myClientRect.bottom;
MoveWindow(&myRect); // resizes and redraws window
}
void CPansrMTCDlg::OnClose()
{
switch (m_state)
{
case DLGC_STARTED_ST:
m_dlgc_button.EnableWindow(FALSE);
m_dlgc_button.SetWindowText(DLGC_STOPPING_STR);
m_state = CLOSING_ST;
if (!SetEvent(ghDLGCEvent)) // unsuccessful
{
MessageBox("Set event failed in OnDlgcButton", "error",
MB_ICONEXCLAMATION);
}
break;
case DLGC_STOPPED_ST:
CDialog::OnClose();
break;
default:
MessageBox("CPansrMTCDlg::OnClose default case.");
CDialog::OnClose();
break;
}
}
void CPansrMTCDlg::OnOK
()
{
//Sleep(1000);
SendMessage(WM_CLOSE);
}
void CPansrMTCDlg::OnCancel()
{
}
void CPansrMTCDlg::OnRadioAnalog
()
{
UpdateData(TRUE);
m_static_dti.EnableWindow(!m_analog);
m_edit_dti.EnableWindow(!m_analog);
m_button_peb.EnableWindow(m_analog);
}
void CPansrMTCDlg::OnHelpIndex()
{
WinHelp(0L, HELP_INDEX);
}
void CPansrMTCDlg::OnSetting()
{
// TODO: Add your control notification handler code here
CSettingDialog Dig;
Dig.DoModal();
}
void CPansrMTCDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
int chdev;
if((chdev = dx_open("dxxxB1C1", 0)) == -1)
goto HERE;
else
dx_close(chdev);
if(!m_bRunning2)
{
m_bRunning2 = TRUE;
m_state = DLGC_STOPPED_ST;
OnDlgcButton();
}
HERE:
CDialog::OnTimer(nIDEvent);
}
void CPansrMTCDlg::OnButtonCompile()
{
WinExec("LVCompiler.exe", SW_SHOW);
}
void CPansrMTCDlg::OnButtonSimuphone()
{
m_bRunning2 = TRUE;
::EnableWindow(::GetDlgItem(this->m_hWnd, IDC_DLGC_BUTTON), FALSE);
::EnableWindow(::GetDlgItem(this->m_hWnd, IDC_BUTTON_SIMUPHONE), FALSE);
int iChannelCount = GetPrivateProfileInt("CHANNEL", "MAXCHANS", 4, ".\\Setup.ini" );
RunVSInterpreter(iChannelCount);
RunSimuDialogic(iChannelCount);
}