// RemoteParamReport.cpp : implementation file // #include "stdafx.h" #include "StoneU_HC_OCX.h" #include "RemoteParamReport.h" #include ".\remoteparamreport.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CRemoteParamReport dialog CRemoteParamReport::CRemoteParamReport(CWnd* pParent /*=NULL*/) : CDialog(CRemoteParamReport::IDD, pParent) { //{{AFX_DATA_INIT(CRemoteParamReport) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT m_SuicideTimer = WM_USER + 100; } void CRemoteParamReport::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CRemoteParamReport) DDX_Control(pDX, IDC_REPORTLIST, m_ReportList); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CRemoteParamReport, CDialog) //{{AFX_MSG_MAP(CRemoteParamReport) ON_WM_TIMER() ON_WM_CREATE() //}}AFX_MSG_MAP ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRemoteParamReport message handlers void CRemoteParamReport::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default if (nIDEvent == m_SuicideTimer) { OnCancel(); } CDialog::OnTimer(nIDEvent); } BOOL CRemoteParamReport::OnInitDialog() { CDialog::OnInitDialog(); CRect rc(0, 0, 0, 0); GetWindowRect(&rc); CRect adjust(0, 0, 0, 0); GetParent()->GetWindowRect(&adjust); ClientToScreen(&adjust); SetWindowPos(&CWnd::wndTop, adjust.left*2/3, adjust.top, rc.Width(), rc.Height(), SWP_SHOWWINDOW); // TODO: Add extra initialization here m_ReportList.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT); m_ReportList.InsertColumn(0, "错误提示", LVCFMT_LEFT, 500, -1); SetTimer(m_SuicideTimer, 10000, NULL); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CRemoteParamReport::InsertReport(char *Report, int len) { if (IsWindow(this->GetSafeHwnd())) { memset(m_ReportBuf, 0, MAX_PATH); memcpy(m_ReportBuf, Report, len); m_ReportList.InsertItem(m_ReportList.GetItemCount(), m_ReportBuf); } } void CRemoteParamReport::OnCancel() { // TODO: Add extra cleanup here KillTimer(m_SuicideTimer); CDialog::OnCancel(); DestroyWindow(); } int CRemoteParamReport::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CDialog::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here return 0; } void CRemoteParamReport::OnBnClickedCancel() { // TODO: 在此添加控件通知处理程序代码 OnCancel(); }