CChengzhongWnd.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #pragma once
  2. #include "../pch/pch.h"
  3. #include "CMainWnd.h"
  4. #include "../helper/CSerialPort.h"
  5. #include "CModalWnd.h"
  6. class CChengzhongWnd : public CModalWnd
  7. {
  8. public:
  9. LPCTSTR GetWindowClassName() const
  10. {
  11. return _T("UIMemoWndFrame");
  12. };
  13. UINT GetClassStyle() const
  14. {
  15. return UI_CLASSSTYLE_DIALOG;
  16. };
  17. void OnFinalMessage(HWND /*hWnd*/)
  18. {
  19. //WindowImplBase::OnFinalMessage(hWnd);
  20. m_pm.RemovePreMessageFilter(this);
  21. //delete this;
  22. };
  23. void Init();
  24. std::string getContent();
  25. void SetTitle(std::wstring title);
  26. void SetPrice(std::string price);
  27. void Notify(TNotifyUI& msg);
  28. LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  29. LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  30. LRESULT OnNcActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  31. {
  32. if (::IsIconic(*this))
  33. {
  34. bHandled = FALSE;
  35. }
  36. return (wParam == 0) ? TRUE : FALSE;
  37. }
  38. LRESULT OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  39. {
  40. return 0;
  41. }
  42. LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  43. {
  44. return 0;
  45. }
  46. LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  47. LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  48. LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
  49. LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled);
  50. LRESULT OnChengzhongSuccess(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  51. //读取串口的值,用于电子秤读取数据
  52. void ReadChuankouValue();
  53. void SaveWeight();
  54. void Quit();
  55. //处理键盘捕捉结果
  56. void HandleTextCapture(std::string content)
  57. {
  58. }
  59. public:
  60. CPaintManagerUI m_pm;
  61. //商品单价
  62. std::string m_price;
  63. //最终称出来的重量
  64. std::string m_weight;
  65. //临时读取到的串口数据
  66. std::string m_chuankou_string;
  67. //这个表示当前是否正在读取串口值
  68. bool m_is_chuangkou_working = false;
  69. bool m_is_watching = false;
  70. CSerialPort m_serial;
  71. };