PeeperWnd.h
Upload User: xztxsm
Upload Date: 2007-02-12
Package Size: 150k
Code Size: 5k
Category:

Remote Control

Development Platform:

Visual C++

  1. ///////////////////////////////////////////////////////////////////////////////
  2. // 远程控制软件-偷窥者  开发库                                               //
  3. // 日期:2001/10/02                                                           //
  4. // 作者:刘东发                                                               //
  5. // Email:dongfa@yeah.net                                                     //
  6. // http://dongfa.yeah.net                                                    //
  7. // OICQ:5584173  阿东                                                        //
  8. // 作者声明:                                                                 //
  9. //     此部分代码全是作者所写,或以随便传播,但要保持文件的完整性,有问题     //
  10. // 或者意见请来信,谢谢!                                                      //
  11. ///////////////////////////////////////////////////////////////////////////////
  12. #ifndef __PEEPER_WND_H__
  13. #define __PEEPER_WND_H__
  14. #include "../PeeperLib.h"
  15. class CPeeperWnd;
  16. class CPeeperThread : public CWinThread
  17. {
  18. DECLARE_DYNCREATE(CPeeperThread)
  19. public:
  20. CPeeperThread();
  21. virtual ~CPeeperThread();
  22. public:
  23. SIZE m_szScreen;
  24. CPeeperWnd *m_pPeeperWnd;
  25. public:
  26. virtual BOOL InitInstance()
  27. {
  28. return TRUE;
  29. }
  30. virtual int ExitInstance()
  31. {
  32. return CWinThread::ExitInstance();
  33. }
  34. protected:
  35. afx_msg HRESULT OnMsgGetDIB(WPARAM, LPARAM);
  36. afx_msg HRESULT OnMsgConnect(WPARAM, LPARAM);
  37. //{{AFX_MSG(CGetDIBThread)
  38. //}}AFX_MSG
  39. DECLARE_MESSAGE_MAP()
  40. };
  41. class CPeeperWnd : public CScrollView
  42. {
  43. DECLARE_DYNCREATE(CPeeperWnd)
  44. public:
  45. CPeeperWnd(CWnd *pNotifyWnd = NULL);
  46. virtual ~CPeeperWnd();
  47. BOOL Create(CString strIP, UINT uPort, CWnd *pParent = NULL, 
  48. int nBits = -1, UINT nTimer = PL_DIB_TIMER);
  49. public:
  50. static CString GetClientVersion();
  51. public:
  52. int      SendData(BYTE *chData, int nLen, BYTE chFlag = PL_NONE);
  53. int      ReadData(BYTE *chData, int nLen, BYTE *chFlag = NULL);
  54. BOOL     ConnectServer();
  55. BOOL     CloseServer();
  56. BOOL     GetState(); // 状态BOOL
  57. CString  GetClientInfo(); // 状态CString
  58. UINT     GetConnectTime();
  59. char    *GetConnectInfo();
  60. void     SetConnectInfo(char *chInfo);
  61. void     SetNotifyWnd(CWnd *pNotifyWnd);
  62. void     SetBits(int nBits);
  63. void     SetUpdateSpeed(UINT nTimer);
  64. BOOL     CanSend();
  65. BOOL     IsPause();
  66. void     Pause();
  67. void     Resume();
  68. DWORD    SetEnableFlag(DWORD dwFlag);
  69. DWORD    SetEnableFlag(DWORD dwFlag, BOOL bSet);
  70. DWORD    GetEnableFlag();
  71. BOOL     GetEnableFlag(DWORD dwEvent);
  72. PL_ColorType GetColorType()
  73. {
  74. return m_ctColor; 
  75. }
  76. PL_ColorType SetColorType(PL_ColorType ct)
  77. {
  78. PL_ColorType old = m_ctColor;
  79. m_ctColor = ct;
  80. return old;
  81. }
  82. PL_ZipType GetZipType()
  83. {
  84. return m_ztZip; 
  85. }
  86. PL_ZipType SetZipType(PL_ZipType zt)
  87. {
  88. PL_ZipType old = m_ztZip;
  89. m_ztZip = zt;
  90. return old;
  91. }
  92. public: // tools function
  93. BOOL T_RunCommand(char *chCommand);
  94. BOOL T_SendMsg(char *chMsg, UINT uType);
  95. BOOL T_ExitWindow(UINT uType);
  96. BOOL T_LockDesktop(BOOL bLock);
  97. BOOL T_CopyFileToRemote(char *chFileSrc, char *chFileDes, HWND hNotifyWnd = NULL);
  98. BOOL T_CopyFileFromRemote(char *chFileSrc, char *chFileDes, HWND hNotifyWnd = NULL);
  99. BOOL T_DeleteFile(char *chFile);
  100. BOOL T_MoveFile(char *chFileSrc, char *chFileDes);
  101. protected:
  102. POINT   GetMousePoint(BYTE *chData = NULL);
  103. BOOL    ExitConnect();
  104. void    DrawDIB();
  105. int     SendDIBBits();
  106. int     GetScreenSize(); //送命令给服务端
  107. CPoint  GetOffsetPos(BOOL bScroll = TRUE);
  108. public:
  109. UINT    m_uPort; //端口号
  110. CString m_strIP; //服务器IP
  111. HDIB    m_hDib;  //桌面图像
  112. SOCKET  m_sckClient[2]; //客户端Socket
  113. protected:
  114. PL_ColorType m_ctColor; //颜色数
  115. PL_ZipType   m_ztZip;   //压缩类型
  116. BOOL m_bIsConnect;
  117. DWORD m_dwEnableFlag;
  118. CWnd *m_pNotifyWnd;
  119. CDC m_memDC;
  120. SIZE m_szScreen;
  121. UINT m_nTimerID;
  122. int m_nBits;
  123. UINT m_nSpeed;
  124. UINT m_nRetryTime;
  125. BOOL m_bIsDoing;
  126. char m_chConnectInfo[512];
  127. CPeeperThread m_hPeeperThread;
  128. BOOL m_bIsPause;
  129. int m_nLastUpdateTime;
  130. CString m_strState;
  131. UINT m_nConnectTime;
  132. //{{AFX_VIRTUAL(CPeeperWnd)
  133. public:
  134. virtual BOOL PreTranslateMessage(MSG* pMsg);
  135. virtual void OnDraw(CDC* pDC);
  136. virtual void OnInitialUpdate();
  137. //}}AFX_VIRTUAL
  138. protected:
  139. afx_msg HRESULT OnMsgPeeperThread(WPARAM wParam, LPARAM lParam);
  140. //{{AFX_MSG(CPeeperWnd)
  141. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  142. afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  143. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  144. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  145. afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
  146. afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
  147. afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
  148. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  149. afx_msg void OnTimer(UINT nIDEvent);
  150. afx_msg void OnDestroy();
  151. afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  152. afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
  153. afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  154. afx_msg void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
  155. //}}AFX_MSG
  156. DECLARE_MESSAGE_MAP()
  157. };
  158. #endif // __PEEPER_WND_H__