ProcessADlg.cpp
上传用户:xinsanhua
上传日期:2022-05-17
资源大小:80k
文件大小:6k
- #include "..processbprocessbdlg.cpp"
- // ProcessADlg.cpp : 备泅 颇老
- //
- #include "stdafx.h"
- #include "ProcessA.h"
- #include "ProcessADlg.h"
- #include ".processadlg.h"
- #include "BookInfo.h"
- #include "Protocol.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #endif
- // 览侩 橇肺弊伐 沥焊俊 荤侩登绰 CAboutDlg 措拳 惑磊涝聪促.
- class CAboutDlg : public CDialog
- {
- public:
- CAboutDlg();
- // 措拳 惑磊 单捞磐
- enum { IDD = IDD_ABOUTBOX };
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 瘤盔
- // 备泅
- protected:
- DECLARE_MESSAGE_MAP()
- // virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
- };
- CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
- {
- }
- void CAboutDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- }
- BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
- // ON_WM_COPYDATA()
- END_MESSAGE_MAP()
- // CProcessADlg 措拳 惑磊
- CProcessADlg::CProcessADlg(CWnd* pParent /*=NULL*/)
- : CDialog(CProcessADlg::IDD, pParent)
- {
- m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
- }
- void CProcessADlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- }
- BEGIN_MESSAGE_MAP(CProcessADlg, CDialog)
- ON_WM_SYSCOMMAND()
- ON_WM_PAINT()
- ON_WM_QUERYDRAGICON()
- //}}AFX_MSG_MAP
- ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
- ON_WM_COPYDATA()
- END_MESSAGE_MAP()
- // CProcessADlg 皋矫瘤 贸府扁
- BOOL CProcessADlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // 矫胶袍 皋春俊 "沥焊..." 皋春 亲格阑 眠啊钦聪促.
- // IDM_ABOUTBOX绰 矫胶袍 疙飞 裹困俊 乐绢具 钦聪促.
- ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
- ASSERT(IDM_ABOUTBOX < 0xF000);
- CMenu* pSysMenu = GetSystemMenu(FALSE);
- if (pSysMenu != NULL)
- {
- CString strAboutMenu;
- strAboutMenu.LoadString(IDS_ABOUTBOX);
- if (!strAboutMenu.IsEmpty())
- {
- pSysMenu->AppendMenu(MF_SEPARATOR);
- pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
- }
- }
- // 捞 措拳 惑磊狼 酒捞能阑 汲沥钦聪促. 览侩 橇肺弊伐狼 林 芒捞 措拳 惑磊啊 酒匆 版快俊绰
- // 橇饭烙况农啊 捞 累诀阑 磊悼栏肺 荐青钦聪促.
- SetIcon(m_hIcon, TRUE); // 奴 酒捞能阑 汲沥钦聪促.
- SetIcon(m_hIcon, FALSE); // 累篮 酒捞能阑 汲沥钦聪促.
- // TODO: 咯扁俊 眠啊 檬扁拳 累诀阑 眠啊钦聪促.
-
- return TRUE; // 牧飘费俊 措茄 器目胶甫 汲沥窍瘤 臼阑 版快 TRUE甫 馆券钦聪促.
- }
- void CProcessADlg::OnSysCommand(UINT nID, LPARAM lParam)
- {
- if ((nID & 0xFFF0) == IDM_ABOUTBOX)
- {
- CAboutDlg dlgAbout;
- dlgAbout.DoModal();
- }
- else
- {
- CDialog::OnSysCommand(nID, lParam);
- }
- }
- // 措拳 惑磊俊 弥家拳 窜眠甫 眠啊且 版快 酒捞能阑 弊府妨搁
- // 酒贰 内靛啊 鞘夸钦聪促. 巩辑/轰 葛胆阑 荤侩窍绰 MFC 览侩 橇肺弊伐狼 版快俊绰
- // 橇饭烙况农俊辑 捞 累诀阑 磊悼栏肺 荐青钦聪促.
- void CProcessADlg::OnPaint()
- {
- if (IsIconic())
- {
- CPaintDC dc(this); // 弊府扁甫 困茄 叼官捞胶 牧咆胶飘
- SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
- // 努扼捞攫飘 荤阿屈俊辑 酒捞能阑 啊款单俊 嘎娩聪促.
- 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;
- // 酒捞能阑 弊赋聪促.
- dc.DrawIcon(x, y, m_hIcon);
- }
- else
- {
- CDialog::OnPaint();
- }
- }
- // 荤侩磊啊 弥家拳等 芒阑 掺绰 悼救俊 目辑啊 钎矫登档废 矫胶袍俊辑
- // 捞 窃荐甫 龋免钦聪促.
- HCURSOR CProcessADlg::OnQueryDragIcon()
- {
- return static_cast<HCURSOR>(m_hIcon);
- }
- BOOL CProcessADlg::PreTranslateMessage(MSG* pMsg)
- {
- // TODO: Add your specialized code here and/or call the base class
- switch(pMsg->message)
- {
- case WM_KEYDOWN:
- {
- switch(pMsg->wParam)
- {
- case VK_ESCAPE:
- case VK_RETURN:
- return TRUE;
- }
- }
- }
- return CDialog::PreTranslateMessage(pMsg);
- }
- void CProcessADlg::OnBnClickedButton1()
- {
- // TODO: Add your control notification handler code here
- //
- // 单捞磐甫 傈价 且 橇肺技胶狼 勤甸阑 捞侩窍扁 困秦 扩档快 按眉甫 掘绢 可聪促.
- //
- CWnd* pWnd = FindWindow(NULL, "ProcessB");
- ASSERT(pWnd);
- //
- // 傈价且 单捞磐甫 悸泼钦聪促.
- //
- BookInfo bookInfo = {1000, {0, }};
-
- TCHAR* szName = _T("Keep going ..");
- bookInfo.m_nID = 1000;
- _tcsncpy(bookInfo.m_szName, szName, _tcslen(szName));
- //
- // 傈价且 单捞磐甫 COPYDATASTURCT俊 悸泼窍绊 傈价钦聪促.
- //
- COPYDATASTRUCT cds;
- cds.dwData = Protocol::PROTOCOL_BOOKINFO;
- cds.cbData = sizeof(bookInfo);
- cds.lpData = (LPVOID)&bookInfo;
- ::SendMessage(pWnd->m_hWnd, WM_COPYDATA, (WPARAM)GetSafeHwnd(), (LPARAM)&cds);
- }
- LRESULT CProcessADlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
- {
- // TODO: Add your specialized code here and/or call the base class
- switch(message)
- {
- case WM_COPYDATA:
- {
- PCOPYDATASTRUCT pcds = (PCOPYDATASTRUCT) lParam;
- //
- // 橇肺配妮俊 蝶弗 贸府甫 困秦辑 ..
- //
- switch(pcds->dwData)
- {
- case Protocol::PROTOCOL_BOOKINFO:
- {
- //
- // 傈价罐篮 单捞磐(COPYDATASTRUCT 备炼眉)甫 钱绢辑 BookInfo俊 悸泼钦聪促.
- //
- BookInfo bookInfo;
- bookInfo.m_nID = ((BookInfo*)pcds->lpData)->m_nID;
- _tcsncpy(bookInfo.m_szName, ((BookInfo*)pcds->lpData)->m_szName, pcds->cbData - sizeof(int));
- //
- // 傈价罐篮 单捞磐甫 皋矫瘤 冠胶甫 免仿钦聪促.
- //
- CString strReceiveMsg;
- strReceiveMsg.Format(_T("ID : %dtName : %s"), bookInfo.m_nID, bookInfo.m_szName);
- AfxMessageBox(strReceiveMsg);
- break;
- }
- case Protocol::PROTOCOL_COOKINFO:
- {
- // Do something ..
- break;
- }
- }
- }
- }
- return CDialog::WindowProc(message, wParam, lParam);
- }