gusucode.com > QQ界面的模拟实现(下)JavaScript源码程序 > QQ界面的模拟实现(下)/myqqapp/MyQQapp/MyLoveSong.cpp
// MyLoveSong.cpp : implementation file // #include "stdafx.h" #include "MyQQ.h" #include "MyLoveSong.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif CString MyLoveSongForBuilding3[]= { "与幸福有关-三栋情歌-献给3栋", "", "静静的3栋,", "静静的躺在校园的怀里,", "轻轻的走进我的心里.", "", "呆呆的望你,", "相伴的岁月。", "与你欢笑共处。", "", "不喜欢遗忘,", "我选择了你。", "黄昏的时候,", "我与你鼓掌!", "", "疲倦的时候,", "温柔的呵护,", "舒心的时刻,", "我尽情歌唱。", "", "熟悉的面孔,", "在我眼前来回晃荡。", "我忧郁的扫描,", "感受世界的美好。", "", "飘落的黄叶子。", "伴着路边的风铃铛,", "我深情的思索,", "想将你长时间的凝望。", "", "当路边的脚步声将我唤醒,", "我从徘徊中醒来。", "是你温柔的双眸,", "可以让我 坦荡的依靠!", "", "与你在一起的每一刻,", "是我爱你的每一天!", "是长期的坚持,", "让我领略到你全部的美丽。", "", "美丽的3栋,", "静静的躺在校园的怀里,", "静静的躺在我的心里!", "2006-5-1" "", }; ///////////////////////////////////////////////////////////////////////////// // 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(246, 208, 255)); 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(246, 208, 255)); dc.TextOut(300, 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); for(int i=0; i<4; i++) { dc.SetTextColor(RGB(255, 158, 255)); dc.TextOut(20, rc.top+i*210, "神啊, 救救我吧!"); Sleep(200); dc.SetTextColor(RGB(0, 225, 0)); dc.TextOut(120, rc.top+i*210, "神啊, 救救我吧!"); Sleep(200); dc.SetTextColor(RGB(0, 128, 100)); dc.TextOut(360, rc.top+i*210, "神啊, 救救我吧!"); Sleep(200); Invalidate(true); } Sleep(2000); CBrush br; br.CreateSolidBrush(RGB(0, 0, 0)); CRect rect; GetClientRect(&rect); CString strWish="儿童节快乐!"; int width=15; for( i=1; i<6; i++) { dc.FillRect(&rect , &br); dc.SetTextColor(RGB(255, 255, 0)); dc.TextOut(GetSystemMetrics(SM_CXSCREEN)/2-3*width*i, GetSystemMetrics(SM_CYSCREEN)/2-width*i/2, strWish); Sleep(300); } dc.SelectObject(pOldfont); Sleep(2000); dc.FillRect(&rect , &br); dc.SetTextColor(RGB(255, 0, 0)); font.CreateFont ( 80, 80, 0, 0,800, FALSE,FALSE,0,0, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "courier"); pOldfont=dc.SelectObject(&font); dc.TextOut(GetSystemMetrics(SM_CXSCREEN)/2-200, GetSystemMetrics(SM_CYSCREEN)/2-80, "装A完毕!"); font.DeleteObject(); dc.SelectObject(pOldfont); Invalidate(true); ReleaseDC(&dc); Sleep(1000); 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(); }