You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
3.0 KiB
111 lines
3.0 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 08/10/2003
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: BoardReceiverDlg.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of BoardReceiverDlg.cpp
|
|
//----------------------------------------------------------------------------
|
|
// BoardReceiverDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "BoardReceiver.h"
|
|
#include "BoardReceiverDlg.h"
|
|
#include "Winspool.h"
|
|
/*
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
*/
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CBoardReceiverDlg dialog
|
|
|
|
|
|
CBoardReceiverDlg::CBoardReceiverDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CBoardReceiverDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CBoardReceiverDlg)
|
|
m_RadioMaster = 0;
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
|
|
void CBoardReceiverDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CBoardReceiverDlg)
|
|
DDX_Control(pDX, IDC_BUTTON_TARGET_FILE, m_ButtonTargetFile);
|
|
DDX_Control(pDX, IDC_COMBO_PORT, m_ComboPort);
|
|
DDX_Control(pDX, IDC_EDIT_TARGET_FILE, m_EditTargetFile);
|
|
DDX_Radio(pDX, IDC_RADIO_MASTER, m_RadioMaster);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CBoardReceiverDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CBoardReceiverDlg)
|
|
ON_BN_CLICKED(IDC_BUTTON_TARGET_FILE, OnButtonTargetFile)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CBoardReceiverDlg message handlers
|
|
|
|
BOOL CBoardReceiverDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
DWORD cbNeeded = 0;
|
|
DWORD cReturned = 0;
|
|
::EnumPorts( NULL, 2, NULL, 0, &cbNeeded, &cReturned );
|
|
|
|
PORT_INFO_2 *pPorts = (PORT_INFO_2*) malloc( cbNeeded );
|
|
|
|
::EnumPorts( NULL, 2, (PBYTE)pPorts, cbNeeded, &cbNeeded, &cReturned );
|
|
|
|
for( DWORD i = 0; i < cReturned; i++ )
|
|
if( !( pPorts[i].fPortType & ( PORT_TYPE_REDIRECTED | PORT_TYPE_NET_ATTACHED ) ) )
|
|
m_ComboPort.AddString( pPorts[i].pPortName );
|
|
|
|
free( pPorts );
|
|
|
|
m_ComboPort.SetCurSel( 0 );
|
|
|
|
SYSTEMTIME st;
|
|
GetLocalTime( &st );
|
|
|
|
TCHAR pFileName[MAX_PATH];
|
|
_sntprintf( pFileName, MAX_PATH, "%04d_%02d_%02d_%02d_%02d_%02d.raw", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond );
|
|
m_EditTargetFile.SetWindowText( pFileName );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CBoardReceiverDlg::OnOK()
|
|
{
|
|
m_EditTargetFile.GetWindowText( m_strFileName );
|
|
m_ComboPort.GetWindowText( m_strPort );
|
|
|
|
CDialog::OnOK();
|
|
}
|
|
|
|
void CBoardReceiverDlg::OnButtonTargetFile()
|
|
{
|
|
CString defFile;
|
|
m_EditTargetFile.GetWindowText( defFile );
|
|
|
|
char szFilter[] = "BoardReceiver files (*.raw)|*.raw|All Files (*.*)|*.*||";
|
|
CFileDialog fd( FALSE, "*.raw", defFile, OFN_HIDEREADONLY, szFilter, this );
|
|
if( fd.DoModal() == IDOK )
|
|
{
|
|
m_EditTargetFile.SetWindowText( fd.GetPathName() );
|
|
}
|
|
}
|