• 大小: 621KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-24
  • 语言: 其他
  • 标签: Modbus  tcp  客户端  

资源简介

Modbus tcp客户端程序,利用VC开发

资源截图

代码片段和文件信息

// ClientsComView.cpp : implementation file
//

#include “stdafx.h“
#include “Modbusclient.h“
#include “ClientsComView.h“
#include “LCLayout.h“

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


enum eClientsComView {
    CLIENTSCOMVIEW_COL_TIME = 0
    CLIENTSCOMVIEW_COL_FROM
    CLIENTSCOMVIEW_COL_MESSAGE
};


/////////////////////////////////////////////////////////////////////////////
// CClientsComView

IMPLEMENT_DYNCREATE(CClientsComView CListView)

CClientsComView::CClientsComView()
{
}

CClientsComView::~CClientsComView()
{
}


BEGIN_MESSAGE_MAP(CClientsComView CListView)
//{{AFX_MSG_MAP(CClientsComView)
ON_WM_CREATE()
ON_COMMAND(ID_FILE_PRINT OnFilePrint)
ON_COMMAND(ID_FILE_SAVE_AS OnViewSaveAs)
ON_WM_DESTROY()
ON_UPDATE_COMMAND_UI(ID_FILE_PRINT OnUpdateFilePrint)
ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_AS OnUpdateFileSaveAs)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CClientsComView drawing

void CClientsComView::OnPaint()
{
CListCtrl& lc = GetListCtrl();

Default();

if (!lc.GetItemCount()) {

        CDC* pDC = GetDC();
        int nSavedDC = pDC->SaveDC();

        CRect rc;
        GetClientRect(&rc);

        CHeaderCtrl* pHC;
        pHC = lc.GetHeaderCtrl();
        if (pHC != NULL)
        {
            CRect rcH;
            pHC->GetItemRect(0 &rcH);
            rc.top += rcH.bottom;
        }

        pDC->FillRect(rc &CBrush(::GetSysColor(COLOR_WINDOW)));
pDC->SetBkMode(TRANSPARENT); 
        pDC->SelectStockobject(ANSI_VAR_FONT);
        pDC->DrawText(CString((LPCSTR)IDS_EMPTY_LIST) rc 
                      DT_CENTER|DT_WORDBREAK|DT_NOPREFIX|
  DT_NOCLIP|DT_VCENTER|DT_SINGLELINE);

        pDC->RestoreDC(nSavedDC);
        ReleaseDC(pDC);
}
}

/////////////////////////////////////////////////////////////////////////////
// CClientsComView printing

BOOL CClientsComView::OnPreparePrinting(CPrintInfo* pInfo)
{
   // return m_printer.OnPreparePrinting(pInfo this &GetListCtrl());
return true;
}

void CClientsComView::OnBeginPrinting(CDC* pDC CPrintInfo* pInfo)
{
    CTime   oTime   = CTime::GetCurrentTime();
    CString timeStr = oTime.Format(IDS_TIME_FORMAT);
    CString szAppName((LPCTSTR)IDR_MAINframe);
    CString szTabName((LPCTSTR)IDS_TAB_CLIENTSCOM);
CString szBuf;
szBuf.Format(“%s - %s“ szAppName szTabName);

   // m_printer.OnBeginPrinting(pDC pInfo szBuf timeStr);
}

void CClientsComView::OnEndPrinting(CDC* pDC CPrintInfo* pInfo)
{
   // m_printer.OnEndPrinting(pDC pInfo);
  //  CListView::OnEndPrinting(pDC pInfo);
}

/*============================================================================

Description:    See MFC.

Return:         -

============================================================================*/
void CClie

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1531  2003-01-21 17:08  ModbusClient1\DialogBarUtil.h

     文件      90112  2003-04-28 15:28  ModbusClient1\ModbusClient.opt

     文件       1316  2003-01-25 09:11  ModbusClient1\ComData.cpp

     文件      14163  2003-03-04 09:13  ModbusClient1\MainFrm.cpp

     文件       1352  2002-08-04 11:44  ModbusClient1\ComData.h

     文件       2934  2003-03-03 10:04  ModbusClient1\MainFrm.h

     文件       1823  2003-03-03 10:04  ModbusClient1\ClientSocket.cpp

    .......    335179  2003-01-17 16:59  ModbusClient1\ModbusApplicationProtocol_v1_1.pdf

     文件       2102  2003-03-03 10:27  ModbusClient1\MessageView.h

     文件       3368  2003-03-03 10:27  ModbusClient1\Resource.h

     文件      67700  2003-03-03 10:27  ModbusClient1\ModbusClient.aps

     文件       6947  2003-04-24 09:29  ModbusClient1\ModbusClient.dsp

     文件       1351  2002-08-04 11:44  ModbusClient1\DocumentHelper.h

     文件       4923  2002-08-04 11:44  ModbusClient1\LCLayout.cpp

     文件      18382  2003-03-03 10:27  ModbusClient1\ModbusClient.rc

     文件      15453  2002-08-04 11:44  ModbusClient1\VisualFx.h

     文件      66817  2002-08-04 11:44  ModbusClient1\VisualFx.cpp

     文件       1099  2003-01-23 10:33  ModbusClient1\StdAfx.h

     文件       2998  2002-08-04 11:44  ModbusClient1\LCLayout.h

     文件      10375  2003-03-04 11:31  ModbusClient1\MessageView.cpp

     文件       1692  2003-03-02 17:11  ModbusClient1\SendCommandView.h

     文件       2092  2003-01-23 10:31  ModbusClient1\ClientsComView.h

     文件       4455  2003-01-21 09:31  ModbusClient1\ReadMe.txt

     文件        781  2003-03-02 22:56  ModbusClient1\ModbusClient.dsw

     文件        214  2003-01-21 09:31  ModbusClient1\StdAfx.cpp

     文件       1480  2003-03-02 17:11  ModbusClient1\SendCommandView.cpp

     文件       1016  2002-08-04 11:44  ModbusClient1\DocumentHelper.cpp

     文件     435200  2003-04-28 15:28  ModbusClient1\ModbusClient.ncb

     文件       2888  2003-04-23 16:31  ModbusClient1\ModbusClient.plg

     文件       6029  2002-08-04 11:44  ModbusClient1\InfoBar.cpp

............此处省略31个文件信息

评论

共有 条评论