⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mysundlg.h

📁 对文件加密解密 附带文件传输功能,感觉还可以哦!
💻 H
字号:
// MysunDlg.h : header file
//
#include "ListenSocket.h"
#include "ClientSocket.h"

#if !defined(AFX_MYSUNDLG_H__F0181018_9032_4847_9B49_0E02215B1CDE__INCLUDED_)
#define AFX_MYSUNDLG_H__F0181018_9032_4847_9B49_0E02215B1CDE__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/////////////////////////////////////////////////////////////////////////////
// CMysunDlg dialog
extern "C" void my_des(unsigned char *inblock, unsigned char *outblock,unsigned char *m_key,short edf);
void Hex_Char(unsigned char *bufin,unsigned char *bufout,int  len);
void Char_Hex(unsigned char *bufin,unsigned char *bufout,int  len);

void my_c3des(unsigned char *inblock, int len, unsigned char *outblock, unsigned char *m_key, short edf);
void my_3des(unsigned char *inblock, unsigned char *outblock, unsigned char *m_key, short edf);

#define PORT 1024
#define BLOCKSIZE 1024         //缓冲区大小

#define SERVER 0
#define CLIENT 1

#define CONNECT_BE_ACCEPT    0x00
#define CONNECT_BE_REFUSE    0x01
#define DISCONNECT           0x02
#define REQUEST              0x03
#define ACCEPT               0x04
#define REFUSE               0x05
#define CANCEL               0x06

class CListenSocket;
class CClientSocket;


class CMysunDlg : public CDialog
{
// Construction
public:
	void DESEncrypt();
	CListenSocket* m_psockServer;
	CClientSocket* m_psockClient;

	CString m_strPath;
	CString m_name;
	DWORD m_dwFileSize;

	int m_nTimer;
	BOOL m_bIsClient;
	BOOL m_bIsStop, m_bIsWait, m_bIsTransmitting;

	void ProcessAccept();
	void ProcessReceive(CClientSocket* pSocket);

	void SendFile(CSocket &senSo);
	void ReceiveFile(CSocket &recSo);
	
	void TransfersFailed();
	CString GetError(DWORD error);
	int GetLocalHostInfo(CString &strHostName, CString &strIPAddress);

	CMysunDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CMysunDlg)
	enum { IDD = IDD_MYSUN_DIALOG };
    CProgressCtrl	m_ctrlProgress;
	CString	m_key;
	CString	m_strFileName;
	CString	m_strFileSize;
	UINT	m_wPort;
	int		m_nServerType;
	CString	m_choosepath;

	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMysunDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CMysunDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	virtual void OnCancel();
	afx_msg void OnRadioServer();
	afx_msg void OnRadioClient();
	afx_msg void OnBegin();
	afx_msg void OnDisconnect();
	afx_msg void OnSelectFile();
	afx_msg void OnStopTransfers();
	virtual void OnOK();
	afx_msg LRESULT OnAcceptTransfers(WPARAM wParam, LPARAM lParam);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnEncrypt();
	afx_msg void OnDecrypt();
	afx_msg void OnChoose();
	afx_msg void OnButton1();
	afx_msg void OnChangeKey();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MYSUNDLG_H__F0181018_9032_4847_9B49_0E02215B1CDE__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -