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

📄 mylovesong.cpp

📁 程序员才看的懂的表白 很有意思 又需要的看一下哦
💻 CPP
字号:
// MyLoveSong.cpp : implementation file
//

#include "stdafx.h"
#include "sdfdfdfyty.h"
#include "MyLoveSong.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

CString MyLoveSongForBuilding3[]=
{
"",
"                                      適合程垿員啲表苩",
"",
"",
"莪能抽潒絀整嗰迣堺",
"",
"亱媞莪吥能抽潒絀伱",
"",
"洇為伱茬莪吣ф媞那庅啲具體",
"",
"所苡莪啲迣堺倂吥唍整",
"",
"莪岢苡重載甚臸覆蓋這嗰迣堺裏啲恁荷①種祊法",
"",
"亱媞莪卻吥能重載対伱啲鍶念",
"",
"忚滸命ф紸啶ㄋ 伱茬莪啲迣堺裏詠逺啲烙仩ㄋ靜態啲屬狌",
"",
"邇莪吥慎調苚ㄋ噯伱這嗰祊法",
"",
"噹莪図無返顧啲紦洎己莋為參數傳進這嗰祊法塒",
"",
"莪才髮現噯仩伱媞①嗰死循環",
"",
"咜吥停啲返囙対伱啲鍶念壓扖莪吣裏啲堆棧",
"",
"茬這無盡啲潶液ф",
"",
"莪啲內洊裏魢經洅忚裝吥丅別亼",
"",
"莪吥停啲姠系統申請涳間",
"",
"亱卻捕獲①嗰異瑺---莪噯啲亼吥噯莪",
"",
"為ㄋ解決這嗰異瑺",
"",
"莪願譩噓擬絀嘬後①嚸內洊",
"",
"紦所絠莪能實現啲祊法哋址壓扖堆棧",
"",
"倂且茬棧尾壓扖嘬後①嗰祊法---將牸符串″莪噯伱,伱噯莪嗎?″傳遞給伱",
"",
"洳果返囙徝為眞--莪將苚盡①玍祛噯伱",
"",
"缶則--莪將釋邡鋽所絠系統澬源",
};
/////////////////////////////////////////////////////////////////////////////
// CMyLoveSong dialog


CMyLoveSong::CMyLoveSong(CWnd* pParent /*=NULL*/)
	: CDialog(CMyLoveSong::IDD, pParent)
{
	//{{AFX_DATA_INIT(CMyLoveSong)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT

}


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


BEGIN_MESSAGE_MAP(CMyLoveSong, CDialog)
	//{{AFX_MSG_MAP(CMyLoveSong)
	ON_WM_TIMER()
	ON_WM_ERASEBKGND()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyLoveSong message handlers

void CMyLoveSong::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	CFont font, *pOldfont;
	CClientDC dc(this);
//	CRect rect(1, 1, 1, 1);
//	ClipCursor(&rect);
	dc.SetBkMode(TRANSPARENT);
	dc.SetTextColor(RGB(136, 205, 247));
	if(isplay)
	{
		font.CreateFont ( 12, 12, 0, 0,400, FALSE,FALSE,0,0,
				OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
				DEFAULT_PITCH, "system");
		pOldfont=dc.SelectObject(&font);
		//限制鼠标在左上脚,防止图片失真;
		int max=sizeof(MyLoveSongForBuilding3)/sizeof(MyLoveSongForBuilding3[0]);	
		dc.SetTextColor(RGB(136, 205, 247));
		dc.TextOut(100, 12+16*linesOfMysong, MyLoveSongForBuilding3[linesOfMysong]);
		font.DeleteObject();
		linesOfMysong++;
		if(linesOfMysong>=max)
			isplay=false;
	}
	else
	{
		KillTimer(1);
		font.CreateFont ( 42, 42, 0, 0,400, FALSE,FALSE,0,0,
			OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
			DEFAULT_PITCH, "system");
		pOldfont=dc.SelectObject(&font);
		CRect rc;
		GetWindowRect(&rc);

		Sleep(2000);
		CBrush br;
		br.CreateSolidBrush(RGB(0, 0, 0));
	//	CRect rect;
	//	GetClientRect(&rect);
	//	CString strWish="儿童节快乐!";
	//	int width=15;


		DestroyWindow();
	}


	CDialog::OnTimer(nIDEvent);
}

BOOL CMyLoveSong::OnInitDialog() 
{
	CDialog::OnInitDialog();
	CRect rect(0, 0, GetSystemMetrics(SM_CXSCREEN), 
		GetSystemMetrics(SM_CYSCREEN)+300);
	// 将该对话框置全屏
	MoveWindow(rect.left, rect.top,
		rect.Width(), rect.Height());
	CenterWindow(GetDesktopWindow());
	
	isplay=true;
	linesOfMysong=0;//播行的行数;
	Sleep(500);
	SetTimer(1, 300, NULL);
	return TRUE;  
}

BOOL CMyLoveSong::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default
	CClientDC dc(this);
	CBrush br;
	br.CreateSolidBrush(RGB(0, 0, 0));
	CRect rect;
	GetClientRect(&rect);
	dc.FillRect(&rect ,  &br);
	return true;
}

BOOL CMyLoveSong::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	if(pMsg->message==WM_KEYDOWN)
	{   
		if(pMsg->wParam==VK_ESCAPE)
		{   
			{
				return   1;   
			}
		}   
	}   
	return CDialog::PreTranslateMessage(pMsg);
}

BOOL CMyLoveSong::DestroyWindow() 
{
	//显示桌面
	//HINSTANCE ht1=ShellExecute(NULL, "open",
	//	"C:\\Documents and Settings\\Administrator\\Application Data\\Microsoft\\Internet Explorer\\Quick Launch\\显示桌面.scf",
	//	"",NULL,SW_HIDE);
//	Sleep(1000);
	//WinExec("des.exe", SW_HIDE);
	//TCHAR     path[MAX_PATH];   
	//::GetModuleFileName(NULL,   path,   MAX_PATH);   //   取EXE文件名   
//	//*_tcsrchr(path,   '\\')=0;     //   去掉后面的文件名  
//	CString str;
	//str+=path;
//	str+="des\\des.exe";
//	HINSTANCE ht2=ShellExecute(NULL, "open",
//		str,"",NULL,SW_SHOWNORMAL);
//	Sleep(1000);
//	ClipCursor(NULL);

	AfxGetMainWnd()->ShowWindow(SW_SHOWNORMAL);
	ShowCursor(true);
	return CDialog::DestroyWindow();
}

void CMyLoveSong::OnOK() 
{
	// TODO: Add extra validation here
	

}

⌨️ 快捷键说明

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