ProcessBDlg.cpp
上传用户:xinsanhua
上传日期:2022-05-17
资源大小:80k
文件大小:5k
源码类别:

通讯编程

开发平台:

Visual C++

  1. // ProcessBDlg.cpp : 备泅 颇老
  2. //
  3. #include "stdafx.h"
  4. #include "ProcessB.h"
  5. #include "ProcessBDlg.h"
  6. #include ".processbdlg.h"
  7. #include "BookInfo.h"
  8. #include "Protocol.h"
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #endif
  12. // 览侩 橇肺弊伐 沥焊俊 荤侩登绰 CAboutDlg 措拳 惑磊涝聪促.
  13. class CAboutDlg : public CDialog
  14. {
  15. public:
  16. CAboutDlg();
  17. // 措拳 惑磊 单捞磐
  18. enum { IDD = IDD_ABOUTBOX };
  19. protected:
  20. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔
  21. // 备泅
  22. protected:
  23. DECLARE_MESSAGE_MAP()
  24. };
  25. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  26. {
  27. }
  28. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  29. {
  30. CDialog::DoDataExchange(pDX);
  31. }
  32. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  33. END_MESSAGE_MAP()
  34. // CProcessBDlg 措拳 惑磊
  35. CProcessBDlg::CProcessBDlg(CWnd* pParent /*=NULL*/)
  36. : CDialog(CProcessBDlg::IDD, pParent)
  37. {
  38. m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  39. }
  40. void CProcessBDlg::DoDataExchange(CDataExchange* pDX)
  41. {
  42. CDialog::DoDataExchange(pDX);
  43. }
  44. BEGIN_MESSAGE_MAP(CProcessBDlg, CDialog)
  45. ON_WM_SYSCOMMAND()
  46. ON_WM_PAINT()
  47. ON_WM_QUERYDRAGICON()
  48. //}}AFX_MSG_MAP
  49. // ON_WM_COPYDATA()
  50. ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
  51. END_MESSAGE_MAP()
  52. // CProcessBDlg 皋矫瘤 贸府扁
  53. BOOL CProcessBDlg::OnInitDialog()
  54. {
  55. CDialog::OnInitDialog();
  56. // 矫胶袍 皋春俊 "沥焊..." 皋春 亲格阑 眠啊钦聪促.
  57. // IDM_ABOUTBOX绰 矫胶袍 疙飞 裹困俊 乐绢具 钦聪促.
  58. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  59. ASSERT(IDM_ABOUTBOX < 0xF000);
  60. CMenu* pSysMenu = GetSystemMenu(FALSE);
  61. if (pSysMenu != NULL)
  62. {
  63. CString strAboutMenu;
  64. strAboutMenu.LoadString(IDS_ABOUTBOX);
  65. if (!strAboutMenu.IsEmpty())
  66. {
  67. pSysMenu->AppendMenu(MF_SEPARATOR);
  68. pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
  69. }
  70. }
  71. // 捞 措拳 惑磊狼 酒捞能阑 汲沥钦聪促. 览侩 橇肺弊伐狼 林 芒捞 措拳 惑磊啊 酒匆 版快俊绰
  72. // 橇饭烙况农啊 捞 累诀阑 磊悼栏肺 荐青钦聪促.
  73. SetIcon(m_hIcon, TRUE); // 奴 酒捞能阑 汲沥钦聪促.
  74. SetIcon(m_hIcon, FALSE); // 累篮 酒捞能阑 汲沥钦聪促.
  75. // TODO: 咯扁俊 眠啊 檬扁拳 累诀阑 眠啊钦聪促.
  76. return TRUE;  // 牧飘费俊 措茄 器目胶甫 汲沥窍瘤 臼阑 版快 TRUE甫 馆券钦聪促.
  77. }
  78. void CProcessBDlg::OnSysCommand(UINT nID, LPARAM lParam)
  79. {
  80. if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  81. {
  82. CAboutDlg dlgAbout;
  83. dlgAbout.DoModal();
  84. }
  85. else
  86. {
  87. CDialog::OnSysCommand(nID, lParam);
  88. }
  89. }
  90. // 措拳 惑磊俊 弥家拳 窜眠甫 眠啊且 版快 酒捞能阑 弊府妨搁 
  91. // 酒贰 内靛啊 鞘夸钦聪促. 巩辑/轰 葛胆阑 荤侩窍绰 MFC 览侩 橇肺弊伐狼 版快俊绰
  92. // 橇饭烙况农俊辑 捞 累诀阑 磊悼栏肺 荐青钦聪促.
  93. void CProcessBDlg::OnPaint() 
  94. {
  95. if (IsIconic())
  96. {
  97. CPaintDC dc(this); // 弊府扁甫 困茄 叼官捞胶 牧咆胶飘
  98. SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
  99. // 努扼捞攫飘 荤阿屈俊辑 酒捞能阑 啊款单俊 嘎娩聪促.
  100. int cxIcon = GetSystemMetrics(SM_CXICON);
  101. int cyIcon = GetSystemMetrics(SM_CYICON);
  102. CRect rect;
  103. GetClientRect(&rect);
  104. int x = (rect.Width() - cxIcon + 1) / 2;
  105. int y = (rect.Height() - cyIcon + 1) / 2;
  106. // 酒捞能阑 弊赋聪促.
  107. dc.DrawIcon(x, y, m_hIcon);
  108. }
  109. else
  110. {
  111. CDialog::OnPaint();
  112. }
  113. }
  114. // 荤侩磊啊 弥家拳等 芒阑 掺绰 悼救俊 目辑啊 钎矫登档废 矫胶袍俊辑
  115. //  捞 窃荐甫 龋免钦聪促. 
  116. HCURSOR CProcessBDlg::OnQueryDragIcon()
  117. {
  118. return static_cast<HCURSOR>(m_hIcon);
  119. }
  120. BOOL CProcessBDlg::PreTranslateMessage(MSG* pMsg)
  121. {
  122. // TODO: Add your specialized code here and/or call the base class
  123. switch(pMsg->message)
  124. {
  125. case WM_KEYDOWN:
  126. {
  127. switch(pMsg->wParam)
  128. {
  129. case VK_ESCAPE:
  130. case VK_RETURN:
  131. return TRUE;
  132. }
  133. }
  134. }
  135. return CDialog::PreTranslateMessage(pMsg);
  136. }
  137. LRESULT CProcessBDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
  138. {
  139. // TODO: Add your specialized code here and/or call the base class
  140. switch(message)
  141. {
  142. case WM_COPYDATA:
  143. {
  144. PCOPYDATASTRUCT pcds = (PCOPYDATASTRUCT) lParam;
  145. //
  146. // 橇肺配妮俊 蝶弗 贸府甫 困秦辑 ..
  147. //
  148. switch(pcds->dwData)
  149. {
  150. case Protocol::PROTOCOL_BOOKINFO:
  151. {
  152. //
  153. // 傈价罐篮 单捞磐(COPYDATASTRUCT 备炼眉)甫 钱绢辑 BookInfo俊 悸泼钦聪促.
  154. //
  155. BookInfo bookInfo;
  156. bookInfo.m_nID = ((BookInfo*)pcds->lpData)->m_nID;
  157. _tcsncpy(bookInfo.m_szName, ((BookInfo*)pcds->lpData)->m_szName, pcds->cbData - sizeof(int));
  158. //
  159. // 傈价罐篮 单捞磐甫 皋矫瘤 冠胶甫 免仿钦聪促.
  160. //
  161. CString strReceiveMsg;
  162. strReceiveMsg.Format(_T("ID : %dtName : %s"), bookInfo.m_nID, bookInfo.m_szName);
  163. AfxMessageBox(strReceiveMsg);
  164. //
  165. // wParam栏肺 甸绢 柯 扩档快 勤甸阑 捞侩秦辑 单捞磐甫 傈价茄 橇肺技胶俊霸 单捞磐甫 俊内钦聪促.
  166. //
  167. HWND hWnd = (HWND) wParam;
  168. ::SendMessage(hWnd, WM_COPYDATA, 0, (LPARAM) pcds);
  169. break;
  170. }
  171. case Protocol::PROTOCOL_COOKINFO:
  172. {
  173. // Do something ..
  174. break;
  175. }
  176. }
  177. }
  178. }
  179. return CDialog::WindowProc(message, wParam, lParam);
  180. }
  181. void CProcessBDlg::OnBnClickedButton1()
  182. {
  183. // TODO: Add your control notification handler code here
  184. }