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

📄 030300816dlg.cpp

📁 1、对于凯撒密文
💻 CPP
字号:
// 030300816Dlg.cpp : implementation file
//

#include "stdafx.h"
#include "030300816.h"
#include "030300816Dlg.h"
#include "resource.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

CDictionary dictionary;
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();
	CComQIPtr<ISkin> pSkin2;

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

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

// Implementation
protected:
	HCURSOR m_hArrow;
	HCURSOR m_hHand;
	HCURSOR m_hBeam;
	HCURSOR m_hPen;
	HCURSOR m_hMove;
	//{{AFX_MSG(CAboutDlg)
	virtual BOOL OnInitDialog();
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
	ON_WM_SETCURSOR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMy030300816Dlg dialog

CMy030300816Dlg::CMy030300816Dlg(CWnd* pParent /*=NULL*/)
	: CDialog(CMy030300816Dlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CMy030300816Dlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
	
}

void CMy030300816Dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMy030300816Dlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CMy030300816Dlg, CDialog)
	ON_WM_CONTEXTMENU()
	//{{AFX_MSG_MAP(CMy030300816Dlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_COMMAND(ID_CAESAR_DE, OnCaesarDe)
	ON_COMMAND(IDD_SUB_DE, OnSubDe)
	ON_COMMAND(IDD_ABOUTBOX, OnAboutbox)
	ON_COMMAND(IDD_DICT, OnDict)
	ON_COMMAND(IDD_SUB_KEYWORD, OnSubKeyword)
	ON_COMMAND(IDD_SUB_RANDOM, OnSubRandom)
	ON_COMMAND(IDD_DES, OnDes)
	ON_COMMAND(IDD_VIGENERA, OnVigenera)
	ON_COMMAND(IDD_IDEA, OnIdea)
	ON_COMMAND(IDD_KEYWORD, OnKeyword)
	ON_COMMAND(IDD_LFSR, OnLfsr)
	ON_COMMAND(IDD_PLAYFAIR, OnPlayfair)
	ON_COMMAND(IDD_RC4, OnRc4)
	ON_COMMAND(IDD_CAESAR, OnCaesar)
	ON_COMMAND(IDD_CAESAR_DE, OnCaesarDe)
	ON_WM_SETCURSOR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMy030300816Dlg message handlers
DWORD WINAPI CDict( LPVOID lpParam ) 
{
//	CDictionary* dictionary = (CDictionary*)lpParam;
	dictionary.LoadDictionary("my.dic");
	return 0;
}

BOOL CMy030300816Dlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
/*	m_hTORO_BEAM = AfxGetApp()->LoadCursor(IDC_TORO_BEAM);
	m_hTORO_HAND = AfxGetApp()->LoadCursor(IDC_TORO_HAND);
	m_hTORO_MOVE = AfxGetApp()->LoadCursor(IDC_TORO_MOVE);
	m_hTORO_WAIT = LoadAniCursor(IDC_TORO_WAIT);*/
	m_hArrow = AfxGetApp()->LoadCursor(IDC_MYARROW);
	m_hHand = AfxGetApp()->LoadCursor(IDC_MYHAND);
	m_hBeam = AfxGetApp()->LoadCursor(IDC_MYBEAM);
	m_hPen = AfxGetApp()->LoadCursor(IDC_MYPEN);
	m_hMove = AfxGetApp()->LoadCursor(IDC_MYMOVE);
	// TODO: Add extra initialization here
	pNewMenu = new CMenu; 
	pNewMenu->LoadMenu(IDR_MENU); 
	// Set mainframe menu 
	SetMenu(pNewMenu); 

	//	TerminateThread(hDictThread,dwDictThreadId);
	hDictThread = CreateThread(
			NULL,
			0,
			CDict,
			this,
			0,
			&dwDictThreadId);
		if(hDictThread==NULL)
			AfxMessageBox("创建线程失败!");
	m_wndTaskbarNotifier.Create(this);
//	m_wndTaskbarNotifier
	m_wndTaskbarNotifier.SetSkin(IDB_BITMAP2,255,0,255);
	m_wndTaskbarNotifier.SetTextFont("Arial Black",90,TN_TEXT_NORMAL,TN_TEXT_UNDERLINE | TN_TEXT_BOLD);
	m_wndTaskbarNotifier.SetTextColor(RGB(255,255,255),RGB(200,0,0));
	m_wndTaskbarNotifier.SetTextRect(CRect(10,20,m_wndTaskbarNotifier.m_nSkinWidth-10,m_wndTaskbarNotifier.m_nSkinHeight-20));
	m_wndTaskbarNotifier.Show(" 欢迎使用本解码系统!\r\n本系统将给您带来意想不到的收获!");
//	pSkin1 = GetDlgItem(IDC_SKIN2)->GetControlUnknown();
//	pSkin2 = GetDlgItem(IDC_SKIN3)->GetControlUnknown();
//	pSkin1->ApplySkin((long)m_hWnd);
		return TRUE;  // return TRUE  unless you set the focus to a control
}

void CMy030300816Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CMy030300816Dlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CMy030300816Dlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CMy030300816Dlg::OnCaesarDe() 
{
	// TODO: Add your command handler code here
	CCaesarDeDlg dlg;
//	dlg.pSkin2 = pSkin2;
	dlg.m_pDictionary = &::dictionary;
	dlg.m_wndTaskbarNotifier = &m_wndTaskbarNotifier;
//	dlg.pSkin = pSkin;
	dlg.DoModal();
}

void CMy030300816Dlg::OnSubDe() 
{
	// TODO: Add your command handler code here
	CSubDeDlg dlg;
//	dlg.pSkin2 = pSkin2;
	dlg.m_pDictionary = &::dictionary;
	dlg.m_wndTaskbarNotifier = &m_wndTaskbarNotifier;
	dlg.DoModal();
}

void CMy030300816Dlg::OnAboutbox() 
{
	// TODO: Add your command handler code here
	CAboutDlg dlg;
//	dlg.pSkin2 = pSkin2;
	dlg.DoModal();
}

BOOL CMy030300816Dlg::DestroyWindow() 
{
	// TODO: Add your specialized code here and/or call the base class
		// TODO: Add your message handler code here and/or call default
	CloseHandle(hDictThread);
	return CDialog::DestroyWindow();
}


void CMy030300816Dlg::OnContextMenu(CWnd*, CPoint point)
{
	// CG: This block was added by the Pop-up Menu component	{		if (point.x == -1 && point.y == -1){			//keystroke invocation			CRect rect;			GetClientRect(rect);			ClientToScreen(rect);			point = rect.TopLeft();			point.Offset(5, 5);		}		CMenu menu;		VERIFY(menu.LoadMenu(CG_IDR_POPUP_MY030300816_DLG));		CMenu* pPopup = menu.GetSubMenu(0);		ASSERT(pPopup != NULL);		CWnd* pWndPopupOwner = this;		while (pWndPopupOwner->GetStyle() & WS_CHILD)			pWndPopupOwner = pWndPopupOwner->GetParent();		pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,			pWndPopupOwner);	}
}

void CMy030300816Dlg::OnDict() 
{
	// TODO: Add your command handler code here
	CDictDlg dlg;
//	dlg.pSkin2 = pSkin2;
	dlg.m_pDictionary = &::dictionary;
	dlg.m_wndTaskbarNotifier = &m_wndTaskbarNotifier;
	dlg.DoModal();
}

void CMy030300816Dlg::OnSubKeyword() 
{
	// TODO: Add your command handler code here
	CSubKeywordDlg dlg;
//	dlg.pSkin2 = pSkin2;
	dlg.m_wndTaskbarNotifier = &m_wndTaskbarNotifier;
	dlg.DoModal();
}

void CMy030300816Dlg::OnSubRandom() 
{
	// TODO: Add your command handler code here
	CRandomDlg dlg;
//	dlg.pSkin2 = pSkin2;
	dlg.m_wndTaskbarNotifier = &m_wndTaskbarNotifier;
	dlg.DoModal();
}

void CMy030300816Dlg::OnDes() 
{
	// TODO: Add your command handler code here
	CDesDlg dlg;
//	dlg.pSkin2 = pSkin2;
	dlg.m_wndTaskbarNotifier = &m_wndTaskbarNotifier;
	dlg.DoModal();
}

void CMy030300816Dlg::OnVigenera() 
{
	// TODO: Add your command handler code here
	CVigeneraDlg dlg;
//	dlg.pSkin2 = pSkin2;
	dlg.m_wndTaskbarNotifier = &m_wndTaskbarNotifier;
	dlg.DoModal();
}

void CMy030300816Dlg::OnIdea() 
{
	// TODO: Add your command handler code here
	CIdeaDlg dlg;
//	dlg.pSkin2 = pSkin2;
	dlg.m_wndTaskbarNotifier = &m_wndTaskbarNotifier;
	dlg.DoModal();
}

void CMy030300816Dlg::OnKeyword() 
{
	// TODO: Add your command handler code here
	CKeywordDlg dlg;
//	dlg.pSkin2 = pSkin2;
	dlg.m_wndTaskbarNotifier = &m_wndTaskbarNotifier;
	dlg.DoModal();
}

void CMy030300816Dlg::OnLfsr() 
{
	// TODO: Add your command handler code here
	CLfsrDlg dlg;
//	dlg.pSkin2 = pSkin2;
	dlg.m_wndTaskbarNotifier = &m_wndTaskbarNotifier;
	dlg.DoModal();
}

void CMy030300816Dlg::OnPlayfair() 
{
	// TODO: Add your command handler code here
	CPlayfairDlg dlg;
//	dlg.pSkin2 = pSkin2;
	dlg.m_wndTaskbarNotifier = &m_wndTaskbarNotifier;
	dlg.DoModal();
}

void CMy030300816Dlg::OnRc4() 
{
	// TODO: Add your command handler code here
	CRc4Dlg dlg;
//	dlg.pSkin2 = pSkin2;
	dlg.m_wndTaskbarNotifier = &m_wndTaskbarNotifier;
	dlg.DoModal();
}

void CMy030300816Dlg::OnCaesar() 
{
	// TODO: Add your command handler code here
	CCaesarDlg dlg;
//	dlg.pSkin2 = pSkin2;
	dlg.m_wndTaskbarNotifier = &m_wndTaskbarNotifier;
	dlg.DoModal();
}

BOOL CMy030300816Dlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
{
	// TODO: Add your message handler code here and/or call default
	::SetCursor(m_hArrow);
	return true;
	//	return CDialog::OnSetCursor(pWnd, nHitTest, message);
}

BOOL CAboutDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
//	pSkin2->ApplySkin((long)m_hWnd);
	m_hArrow = AfxGetApp()->LoadCursor(IDC_MYARROW);
	m_hHand = AfxGetApp()->LoadCursor(IDC_MYHAND);
	m_hBeam = AfxGetApp()->LoadCursor(IDC_MYBEAM);
	m_hPen = AfxGetApp()->LoadCursor(IDC_MYPEN);
	m_hMove = AfxGetApp()->LoadCursor(IDC_MYMOVE);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

BOOL CAboutDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
{
	// TODO: Add your message handler code here and/or call default
	if ( pWnd == GetDlgItem(IDOK) 
		)
		::SetCursor(m_hHand);
	else if ( nHitTest == HTCAPTION )
		::SetCursor(m_hMove);
	else
		::SetCursor(m_hArrow);
	return true;
//	return CDialog::OnSetCursor(pWnd, nHitTest, message);
}

⌨️ 快捷键说明

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