當前位置:編程學習大全網 - 源碼下載 - 查找數字雨源代碼或動態

查找數字雨源代碼或動態

用VC成功編輯了程序。

# include & ltwindows.h & gt

#定義ID_TIMER 1

# define strmax EN 25//顯示列的最大長度。

#define STRMINLEN 8 //顯示列的最小長度

LRESULT回調WndProc (HWND,UINT,WPARAM,LPARAM);

//////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////

Typedef struct tagCharChain //作為屏幕的顯示列,它是壹個雙向列表。

{

struct tagCharChain * prev//鏈接列表的第壹個元素

TCHAR ch;//顯示列中的字符

struct tagCharChain * next//鏈表的最後壹個元素

}CharChain,* pCharChain

typedef結構tagCharColumn

{

CharChain *head,*current,* point

int x,y,iStrLen//顯示該列開頭的x和y坐標,iStrLen是該列的長度。

int iStopTimes,iMustStopTimes//已經停止的次數和必須停止的次數。妳必須停止的次數是隨機的。

}CharColumn,* pCharColumn

int main(HINSTANCE hInstance,HINSTANCE hPrevInstance,

PSTR深圳國際展覽中心

{

靜態TCHAR szapname[]= TEXT(" matrix ");

HWND hwnd

味精味精;

WNDCLASS wndclass

wnd class . style = CS _ HREDRAW | CS _ VREDRAW;

wndclass.lpfnWndProc = WndProc

wnd class . cbclsextra = 0;

wnd class . cbwndextra = 0;

wnd class . h instance = h instance;

wndclass.hIcon = LoadIcon (NULL,IDI _應用);

wnd class . hcursor = load cursor(NULL,IDC _ ARROW);

wnd class . HBR background =(HBRUSH)GetStockObject(BLACK _ BRUSH);

wndclass.lpszMenuName = NULL

wnd class . lpszclassname = SZ appname;

如果(!register class(& amp;wndclass))

{

MessageBox (NULL,TEXT("這個程序必須在NT下運行!"),szAppName,MB _ icon error);

返回0;

}

hwnd = CreateWindow (szAppName,NULL,

WS _ DLG frame | WS _ thick frame | WS _ POPUP,

0, 0,

GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),

NULL,NULL,hInstance,

NULL);

ShowWindow (hwnd,SW _ show maximized);//最大化顯示

更新窗口(hwnd);

show cursor(FALSE);//隱藏鼠標光標

srand((int)GetCurrentTime());//初始化隨機數生成器

while(GetMessage(& amp;msg,NULL,0,0))

{

翻譯消息(& amp味精);

dispatch message(amp;味精);

}

show cursor(TRUE);//顯示鼠標光標

返回msg.wParam

}

TCHAR randomChar() //隨機字符生成函數

{

return (TCHAR)(蘭特()%(126-33)+33);//33到126

}

Intinit (charcolumn * cc,int cy screen,int x)//初始化。

{

int j;

cc-& gt;iStrLen = rand()%(str maxlen-str minlen)+str minlen;//顯示列的長度。

cc-& gt;x = x+3;//顯示列開頭的X坐標。

cc-& gt;y =rand()%3?rand()% cy screen:0;//顯示列開頭的y坐標。

cc-& gt;iMustStopTimes = rand()% 6;

cc-& gt;iStopTimes = 0;

cc-& gt;head = cc-& gt;電流=

(pCharChain)calloc(cc->iStrLen,sizeof(char chain));//生成顯示列

for(j = 0;j & ltcc-& gt;iStrLen-1;j++)

{

cc-& gt;當前->;prev = cc-& gt;點;//cc-& gt;Point顯示壹列的前壹個元素。

cc-& gt;當前->;ch = ' \ 0

cc-& gt;當前->;next = cc-& gt;當前+1;//cc-& gt;Current+1顯示壹列的最後壹個元素。

cc-& gt;point = cc-& gt;current++;//cc-& gt;point = cc-& gt;當前;cc-& gt;current++;

}

cc-& gt;當前->;prev = cc-& gt;點;//最後壹個節點

cc-& gt;當前->;ch = ' \ 0

cc-& gt;當前->;next = cc-& gt;頭;

cc-& gt;head->;prev = cc-& gt;當前;//頭節點的前壹個是這個鏈的最後壹個元素。

cc-& gt;current = cc->point = cc-& gt;頭;//釋放應用的內存,參數為current。

cc-& gt;head->;ch = random char();//填充列表頭中的元素。

返回0;

}

LRESULT回調WndProc (HWND hwnd,UINT消息,WPARAM wParam,LPARAM lParam)

{

HDC hdc

//ctn用於確定顯示鏈是否關閉。如果等待次數超過了必須等待的次數,ctn的意思就是下。

int i,j,temp,ctn//j是壹個顯示鏈中除鏈表頭以外的屏幕上顯示的y坐標,temp綠色過度為黑色。

靜態HDC hdcMem

HFONT hFont

靜態HBITMAP hBitmap

靜態int cxScreen,cyScreen//屏幕的寬度和高度。

靜態int iFontWidth=10,iFontHeight=15,iColumnCount//字體的寬度和高度,列數

靜態CharColumn * ccChain

  • 上一篇:消息鉤子的VB中的Hook技術應用
  • 下一篇:問個比較弱的問題,我剛接觸webservice ,axis和axis2 有什麽區別啊?
  • copyright 2024編程學習大全網