It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened,
visit the help center。
9年前关闭。
////////////////comet snake////////////////////////////////////
////////////////////////////////////////////////////////
//Compilator :Microsoft Visual C++
//
//Created by :Dani (Indonesia)
//My Email :dani_marchitect@yahoo.co.id
//My Graduate is Architech
//
/////This is still practice program for me/////////
/////so, many bugs are maybe found////////////////
///////////////////////////////////////////////////////
#include<windows.h>
#include<stdio.h>
#include<time.h>
#include<math.h>
struct tm *local(){
time_t t;
t = time(NULL);
return localtime(&t);
}
const char *ClsName = "BitmapLoading";
const char *WndName = "Easy bitmaploading!";
MSG Msg;
HWND hWnd;
WNDCLASSEX WndClsEx;
HINSTANCE hInstance;
int main(void)
{
GetSystemMenu(GetForegroundWindow(),1);
ShowWindow(GetForegroundWindow(),1);
int D=100;
int m,n;
MoveWindow(GetForegroundWindow(),0,0,0,0,1);
MessageBox(GetForegroundWindow(), "To close the screen running, you can move the cursor on the program taskbar. Right click & then click close ","Users Guide - lonely night rain",MB_ICONASTERISK);
RegisterClassEx(&WndClsEx);
// Create the window object
hWnd = CreateWindow(ClsName,
WndName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
GetForegroundWindow(),
CreatePopupMenu(),
hInstance,
NULL);
HDC hdc=GetDC(hWnd);
for(m=0;m<=(local()->tm_hour*5)+local()->tm_min;m++)rand();//Random based on time
char *Label=" ScreenMove.SoftEng2010 - Copyright 2020 ";
int a[35],b[35],c[35],d[35],e=0;
for(n=1;n<=21;n++){
a[n]=(10+n)*n;
b[n]=(10+n)*n;
c[n]=1,d[n]=1;
}
do{
for(n=1;n<=21;n++){
if(a[n]+(6+n+n)<=740 && a[n]>=0 && c[n]==1)a[n]++;
else{ a[n]--;c[n]=0; }
if(a[n]<=0)c[n]=1;
if(b[n]+(6+n+n)<=1000 && b[n]>=0 && d[n]==1)b[n]++;
else{ b[n]--;d[n]=0; }
if(b[n]<=0)d[n]=1;
e++;
if(e==4)e=0;
RoundRect(hdc,b[n]+(2+n+n)+e,a[n]+(2+n+n)+e,b[n],a[n],b[n],a[n]);
TextOut(hdc,360,10,Label,43);//TEXT
}
for(m=0;m<=D*4;m++)Rectangle(hdc,1300,0,1350,50);
for(n=100;n>=0;n--)LineTo(hdc,rand()%1100,rand()%740);
SetTextColor(hdc,rand());
}while(1);
return 0;
}
您可能想进行错误处理-检查您正在调用的各种win32 API的返回值。诸如CreateWindow之类的功能可能会失败。
另外(前面有主观个人意见),请考虑写作
if(b[n]<=0)
d[n]=1;
代替
if(b[n]<=0)d[n]=1;
并且,使用标志而不是替换其值。例如考虑写:
ShowWindow(GetForegroundWindow(),SW_SHOWNORMAL);
代替
ShowWindow(GetForegroundWindow(),1);
和更好的变量名。
int D = 100;
D是什么?理想情况下,我应该能够通过查看名称来弄清楚变量代表什么。
最后,在整个代码中一致地缩进。