C++实现新年贺卡程序实现新年贺卡程序
主要为大家详细介绍了C++实现贺卡程序,C++应用程序编写的雪花贺卡,具有一定的参考价值,感兴趣的小伙
伴们可以参考一下
用c++应用程序编写的雪花贺卡,逢年过节送给你自己身边的亲友吧
snow.cpp
///////////////////////////////////////////////////////////////////////////////
// Snow.cpp
// Date: 2009-2-5 21:16
// A moving ball.
//
///////////////////////////////////////////////////////////////////////////////
#include <assert.h>
#include "Snow.h"
TCHAR strForWin1[] = "时间过得好快啊!";
TCHAR strForWin2[] = "开学已经十周了..." ;
TCHAR strForWin3[] = "你学的怎么样了?";
TCHAR strForWin4[] = "有问题一定要及时让我知道";
TCHAR strForWin5[] = "祝大家“小光棍节”快乐";
TCHAR strForWin6[] = " CJ Wang 2011.11.1";
const int nMaxHeight = 450;
#define ID_TIMER 1
///////////////////////////////////////////////////////////////////////////////
int WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, char* cmdParam, int cmdShow )
{
char className[] = "Snow";
MovingBall MovingBallClass( WindowsProcedure, className, hInst );
MovingBallClass.Register();
WinMaker win( "-- Have a joy here!", className, hInst );
win.Show( cmdShow );
MSG msg;
int status;
while( ( status = ::GetMessage( & msg, NULL, 0, 0 ) ) != 0 )
{
if ( status == -1 )
return -1;
::TranslateMessage( & msg );
::DispatchMessage( & msg );
}
return msg.wParam;
}
///////////////////////////////////////////////////////////////////////////////
MovingBall::MovingBall( WNDPROC wndProc, const char* className, HINSTANCE hInstance )
{
_class.style = 0;
_class.lpfnWndProc = wndProc; // Windows procedure: mandatory
_class.cbClsExtra = 0;
_class.cbWndExtra = 0;
_class.hInstance = hInstance;
_class.hIcon = 0; // Owner of class: mandatory
_class.hCursor = ::LoadCursor( 0, IDC_ARROW );
_class.hbrBackground = (HBRUSH) ( COLOR_WINDOW + 1 ); // Optional
_class.lpszMenuName = 0;
_class.lpszClassName = className; // Mandatory
}
WinMaker::WinMaker( const char* szCaption, const char* className, HINSTANCE hInstance )
{
DWORD dwStyle = WS_OVERLAPPEDWINDOW;
dwStyle &= ~WS_SIZEBOX;
dwStyle &= ~WS_MAXIMIZEBOX;
dwStyle &= ~WS_MINIMIZEBOX;