MainFrm.h
Upload User: gongniu
Upload Date: 2007-02-07
Package Size: 2009k
Code Size: 11k
Category:

WinSock-NDIS

Development Platform:

Visual C++

  1. // MainFrm.h : interface of the CMainFrame class
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_MAINFRM_H__12BB9B69_5C23_4A93_8206_EAFAAA22E1E4__INCLUDED_)
  5. #define AFX_MAINFRM_H__12BB9B69_5C23_4A93_8206_EAFAAA22E1E4__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #ifndef __AFXEXT_H__
  10. #include <afxext.h>
  11. #endif
  12. enum
  13. {
  14. FILEICON,
  15. DIRECTORYICON,
  16. LOCFILE,
  17. SERVFILE
  18. };
  19. class CMainFrame : public CFrameWnd
  20. {
  21. protected: // create from serialization only
  22. CMainFrame();
  23. DECLARE_DYNCREATE(CMainFrame)
  24. // Attributes
  25. public:
  26. BOOL m_bConnected;
  27. CString GetFtpName();
  28. int GetFtpPort();
  29. CString GetFtpUser();
  30. CString GetFtpPassword();
  31. // Operations
  32. public:
  33. void GetFtpPara(CComboBoxEx* pCombo);
  34. // Overrides
  35. // ClassWizard generated virtual function overrides
  36. //{{AFX_VIRTUAL(CMainFrame)
  37. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  38. //}}AFX_VIRTUAL
  39. // Implementation
  40. public:
  41. virtual ~CMainFrame();
  42. #ifdef _DEBUG
  43. virtual void AssertValid() const;
  44. virtual void Dump(CDumpContext& dc) const;
  45. #endif
  46. protected:  // control bar embedded members
  47. CStatusBar  m_wndStatusBar;
  48. CToolBar    m_wndToolBar;
  49. // Generated message map functions
  50. protected:
  51. CSplitterWnd m_wndSplitter1;
  52. CSplitterWnd m_wndSplitter2;
  53. virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
  54. CDialogBar m_wndMyDialogBar;
  55. //{{AFX_MSG(CMainFrame)
  56. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  57. afx_msg void OnQuickconnect();
  58. afx_msg void OnFileDisconnect();
  59. afx_msg void OnFileStop();
  60. afx_msg void OnUpdateFileDisconnect(CCmdUI* pCmdUI);
  61. afx_msg void OnFileReconnect();
  62. //}}AFX_MSG
  63. DECLARE_MESSAGE_MAP()
  64. };
  65. /////////////////////////////////////////////////////////////////////////////
  66. class CFtpParaClass  
  67. {
  68. public:
  69. CFtpParaClass();
  70. protected:
  71. HCURSOR m_hDragCursor;
  72. BOOL m_bDragging;
  73. CImageList* m_pDragImageList;
  74. CImageList m_ctImageList;
  75. public:
  76. typedef struct
  77. {
  78. char szFileName[256];
  79. char szFileDate[20];
  80. char szFileSize[20];
  81. int nType;
  82. }FILE_FTP_INFO;
  83. typedef struct
  84. {
  85. char fileName[256];
  86. UINT ufileFlag;
  87. }FILE_COUNT_INFO;
  88. typedef struct
  89. {
  90. char OldName[256];
  91. char NewName[256];
  92. }FILE_CHANGE_INFO;
  93. protected:
  94. void SetPopMenu(int nIndex);
  95. void OnFileName(CListCtrl* pListCtrl);
  96. void OnInsertFile(CListCtrl* pListCtrl,LPVOID pIn,LPARAM lParam);
  97. void GetFileIcon(CString& fileName,int* iIcon,int* iIconSel=NULL);
  98. BOOL SetImageList(CListCtrl* pListCtrl,CComboBoxEx* pCombo=NULL);
  99. void SetFileColumns(CListCtrl* pListCtrl);
  100. public:
  101. virtual ~CFtpParaClass();
  102. };
  103. /////////////////////////////////////////////////////////////////////////////
  104. // CLocFileView form view
  105. class CLocFileView : public CFormView ,public CFtpParaClass
  106. {
  107. protected:
  108. CLocFileView();           // protected constructor used by dynamic creation
  109. DECLARE_DYNCREATE(CLocFileView)
  110. // Form Data
  111. public:
  112. //{{AFX_DATA(CLocFileView)
  113. enum { IDD = IDD_LOC_FORMVIEW };
  114. CListCtrl m_ctLocFile;
  115. CComboBoxEx m_ctLocDir;
  116. //}}AFX_DATA
  117. // Attributes
  118. public:
  119. // Operations
  120. public:
  121. protected:
  122. CMainFrame* m_pMainFrame;
  123. BOOL m_bHaveDotFlag;
  124. CWinThread* m_pSendFileThread;
  125. CWinThread* m_pFindLocFileThread;
  126. int m_iDirCount;
  127. // Overrides
  128. // ClassWizard generated virtual function overrides
  129. //{{AFX_VIRTUAL(CLocFileView)
  130. public:
  131. virtual void OnInitialUpdate();
  132. virtual BOOL PreTranslateMessage(MSG* pMsg);
  133. protected:
  134. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  135. //}}AFX_VIRTUAL
  136. // Implementation
  137. protected:
  138. BOOL BeginSendFile(LPVOID pInfo);
  139. void GetLocCurrentDirectory();
  140. BOOL BeginFindLocFile();
  141. void GetLocDir();
  142. int InsertLocDir(CString& str,int iIcon,int iIconSel);
  143. virtual ~CLocFileView();
  144. #ifdef _DEBUG
  145. virtual void AssertValid() const;
  146. virtual void Dump(CDumpContext& dc) const;
  147. #endif
  148. // Generated message map functions
  149. //{{AFX_MSG(CLocFileView)
  150. afx_msg void OnDblclkLocFile(NMHDR* pNMHDR, LRESULT* pResult);
  151. afx_msg void OnSize(UINT nType, int cx, int cy);
  152. afx_msg void OnSelchangeLocDir();
  153. afx_msg void OnDropdownLocDir();
  154. afx_msg void OnBegindragLocFile(NMHDR* pNMHDR, LRESULT* pResult);
  155. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  156. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  157. afx_msg void OnRclickLocFile(NMHDR* pNMHDR, LRESULT* pResult);
  158. afx_msg void OnBeginlabeleditLocFile(NMHDR* pNMHDR, LRESULT* pResult);
  159. afx_msg void OnEndlabeleditLocFile(NMHDR* pNMHDR, LRESULT* pResult);
  160. //}}AFX_MSG
  161. afx_msg LRESULT OnReDisplayLocFile(WPARAM wParam,LPARAM lParam);
  162. afx_msg LRESULT OnSetLocDirectoryDisplay(WPARAM wParam,LPARAM lParam);
  163. afx_msg LRESULT OnInsertLocFile(WPARAM wParam,LPARAM lParam);
  164. afx_msg LRESULT OnSetLocRedrawFlag(WPARAM wParam,LPARAM lParam);
  165. afx_msg LRESULT OnSetLocDir(WPARAM wParam,LPARAM lParam);
  166. afx_msg void OnLocFileSend();
  167. afx_msg void OnLocFileDelete();
  168. afx_msg void OnLocFileReName();
  169. afx_msg void OnLocFileOpen();
  170. DECLARE_MESSAGE_MAP()
  171. };
  172. /////////////////////////////////////////////////////////////////////////////
  173. /////////////////////////////////////////////////////////////////////////////
  174. // CServFileView form view
  175. class CServFileView : public CFormView ,public CFtpParaClass
  176. {
  177. protected:
  178. CServFileView();           // protected constructor used by dynamic creation
  179. DECLARE_DYNCREATE(CServFileView)
  180. // Form Data
  181. public:
  182. BOOL BeginRenameFile(LPVOID pInfo);
  183. BOOL BeginReceiveFile(LPVOID pIn);
  184. BOOL BeginFindServFile();
  185. BOOL BeginDeleteFile(LPVOID pInfo);
  186. //{{AFX_DATA(CServFileView)
  187. enum { IDD = IDD_SERV_FORMVIEW };
  188. CButton m_ctBack;
  189. CListCtrl m_ctServFile;
  190. CComboBoxEx m_ctServDir;
  191. //}}AFX_DATA
  192. // Attributes
  193. public:
  194. // Operations
  195. public:
  196. protected:
  197. HBITMAP hBitmap;
  198. CMainFrame* m_pMainFrame;
  199. CImageList m_ctServImageList;
  200. CWinThread*m_pRenameFileThread;
  201. CWinThread* m_pDeleteFileThread;
  202. CWinThread* m_pReceiveFileThread;
  203. CWinThread* m_pFindServFileThread;
  204. BOOL m_bHaveDotFlag;
  205. // Overrides
  206. // ClassWizard generated virtual function overrides
  207. //{{AFX_VIRTUAL(CServFileView)
  208. public:
  209. virtual void OnInitialUpdate();
  210. virtual BOOL PreTranslateMessage(MSG* pMsg);
  211. protected:
  212. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  213. //}}AFX_VIRTUAL
  214. // Implementation
  215. protected:
  216. BOOL SetServImageList(UINT nBitmapID);
  217. virtual ~CServFileView();
  218. #ifdef _DEBUG
  219. virtual void AssertValid() const;
  220. virtual void Dump(CDumpContext& dc) const;
  221. #endif
  222. // Generated message map functions
  223. //{{AFX_MSG(CServFileView)
  224. afx_msg void OnSize(UINT nType, int cx, int cy);
  225. afx_msg void OnDblclkServFile(NMHDR* pNMHDR, LRESULT* pResult);
  226. afx_msg void OnBegindragServFile(NMHDR* pNMHDR, LRESULT* pResult);
  227. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  228. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  229. afx_msg void OnRclickServFile(NMHDR* pNMHDR, LRESULT* pResult);
  230. afx_msg void OnBeginlabeleditServFile(NMHDR* pNMHDR, LRESULT* pResult);
  231. afx_msg void OnEndlabeleditServFile(NMHDR* pNMHDR, LRESULT* pResult);
  232. afx_msg void OnBack();
  233. //}}AFX_MSG
  234. afx_msg LRESULT OnInsertServFile(WPARAM wParam,LPARAM lParam);
  235. afx_msg LRESULT OnSetServRedrawFlag(WPARAM wParam,LPARAM lParam);
  236. afx_msg LRESULT OnSetServDirectoryDisplay(WPARAM wParam,LPARAM lParam);
  237. afx_msg LRESULT OnReDisplayServFile(WPARAM wParam,LPARAM lParam);
  238. afx_msg LRESULT OnSetServDir(WPARAM wParam,LPARAM lParam);
  239. afx_msg void OnServFileDownload();
  240. afx_msg void OnServFileDelete();
  241. afx_msg void OnServFileReName();
  242. afx_msg void OnServFileOpen();
  243. DECLARE_MESSAGE_MAP()
  244. };
  245. /////////////////////////////////////////////////////////////////////////////
  246. /////////////////////////////////////////////////////////////////////////////
  247. // CFtpInfoView view
  248. class CFtpInfoView : public CEditView
  249. {
  250. protected:
  251. CFtpInfoView();           
  252. // protected constructor used by dynamic creation
  253. DECLARE_DYNCREATE(CFtpInfoView)
  254. // Attributes
  255. public:
  256. // Operations
  257. public:
  258. // Overrides
  259. // ClassWizard generated virtual function overrides
  260. //{{AFX_VIRTUAL(CFtpInfoView)
  261. protected:
  262. virtual void OnDraw(CDC* pDC);      // overridden to draw this view
  263. //}}AFX_VIRTUAL
  264. // Implementation
  265. protected:
  266. CFont m_NewFont;
  267. virtual ~CFtpInfoView();
  268. #ifdef _DEBUG
  269. virtual void AssertValid() const;
  270. virtual void Dump(CDumpContext& dc) const;
  271. #endif
  272. // Generated message map functions
  273. protected:
  274. //{{AFX_MSG(CFtpInfoView)
  275. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  276. afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  277. afx_msg void OnFileReconnect();
  278. //}}AFX_MSG
  279. afx_msg LRESULT OnRecordFtpInfo(WPARAM wParam,LPARAM lParam);
  280. DECLARE_MESSAGE_MAP()
  281. };
  282. /////////////////////////////////////////////////////////////////////////////
  283. /////////////////////////////////////////////////////////////////////////////
  284. // CMyAppThread thread
  285. #include <afxinet.h>
  286. class CMyAppThread : public CWinThread
  287. {
  288. DECLARE_DYNCREATE(CMyAppThread)
  289. protected:
  290. CMyAppThread();           // protected constructor used by dynamic creation
  291. // Attributes
  292. public:
  293. // Operations
  294. public:
  295. static UINT RenameFileThread(LPVOID lParam);
  296. static UINT DeleteFileThread(LPVOID lParam);
  297. static UINT ReceiveFileThread(LPVOID lParam);
  298. static UINT SendFileThread(LPVOID lParam);
  299. static UINT FindLocFileThread(LPVOID lParam);
  300. static UINT FindServFileThread(LPVOID lParam);
  301. protected:
  302. static BOOL PreDeleteFile(HINTERNET hInetSession,CString& strFtp,CString& OldDir);
  303. static BOOL PreReceiveFile(HINTERNET hInetSession,CString& str,CString& strFtp,LPVOID pInf);
  304. static BOOL PreSendFile(CFtpConnection* lpFtp,CString& str,CString& strFtp,LPVOID pInf);
  305. // Overrides
  306. // ClassWizard generated virtual function overrides
  307. //{{AFX_VIRTUAL(CMyAppThread)
  308. public:
  309. virtual BOOL InitInstance();
  310. virtual int ExitInstance();
  311. //}}AFX_VIRTUAL
  312. // Implementation
  313. protected:
  314. virtual ~CMyAppThread();
  315. // Generated message map functions
  316. //{{AFX_MSG(CMyAppThread)
  317. // NOTE - the ClassWizard will add and remove member functions here.
  318. //}}AFX_MSG
  319. DECLARE_MESSAGE_MAP()
  320. };
  321. /////////////////////////////////////////////////////////////////////////////
  322. /////////////////////////////////////////////////////////////////////////////
  323. // CInputEdit window
  324. class CInputEdit : public CEdit
  325. {
  326. // Construction
  327. public:
  328. CInputEdit(int iItem,int iSubItem,CString& szInitText,CListCtrl* pListCtrl);
  329. // Attributes
  330. public:
  331. // Operations
  332. private:
  333. CListCtrl* m_pListCtrl;
  334. CString m_szInitText;
  335. int m_iItem;
  336. int m_iSubItem;
  337. BOOL m_bEsc;
  338. public:
  339. // Overrides
  340. // ClassWizard generated virtual function overrides
  341. //{{AFX_VIRTUAL(CInputEdit)
  342. public:
  343. virtual BOOL PreTranslateMessage(MSG* pMsg);
  344. //}}AFX_VIRTUAL
  345. // Implementation
  346. public:
  347. virtual ~CInputEdit();
  348. // Generated message map functions
  349. protected:
  350. //{{AFX_MSG(CInputEdit)
  351. afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  352. afx_msg void OnKillFocus(CWnd* pNewWnd);
  353. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  354. afx_msg void OnNcDestroy();
  355. //}}AFX_MSG
  356. DECLARE_MESSAGE_MAP()
  357. };
  358. /////////////////////////////////////////////////////////////////////////////
  359. //{{AFX_INSERT_LOCATION}}
  360. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  361. #endif // !defined(AFX_MAINFRM_H__12BB9B69_5C23_4A93_8206_EAFAAA22E1E4__INCLUDED_)