请问如何将这段C代码改成基于对话框的VC程序?
因为对VC不熟,现在需要将这段C代码改成基于对话框的VC工程,
C代码如下:
C/C++ code:
#include <windows.h>
#include <time.h>
const int ScrnWidth=1024;
const int ScrnHight=768;
const long SnowCol =0xFEFFFE;
const long SnowColDown =0xFFFFFF;
const long SnowColDuck =0xFFDDDD;
const int SnowNum = 400;
const int ID_TIMER = 1;
const char g_szClassName[] = "myWindowClass";
typedef struct POINTAPI
{
long x;
long y;
} a;
static HDC hDC1;
static struct POINTAPI pData[500];
static long pColor[500];
static int Vx,Vy,PVx,PVy,timecont;
long Abs(long num)
{
if(num>=0)return(num);
else return(-num);
}
int Random(int max)
{
return(rand()%max);
}
void InitP(int i)
{
pData[i].x=Random(ScrnWidth);
pData[i].y = Random(5);
pColor[i] = GetPixel(hDC1, pData[i].x, pData[i].y);
}
long GetContrast(int i)
{
long ColorCmp;
long tempR;
long tempG;
long tempB;
int Slope;
if(PVy!=0) Slope = PVx / PVy;
else Slope = 2;
if(Slope==0) ColorCmp = GetPixel(hDC1, pData[i].x, pData[i].y + 1);
else if(Slope > 1) ColorCmp = GetPixel(hDC1, pData[i].x + 1, pData[i].y + 1);
else ColorCmp = GetPixel(hDC1, pData[i].x - 1, pData[i].y + 1);
if(ColorCmp==SnowCol)return 0;
相关问答:
请问用C或C++如何编写求解3D魔方的程序,该从何开始?
谢谢各位,帮忙提点建议吧。
http://www.mofang.net/code/176/182/6581.html
我只能突破60秒!唉。
我刚过40秒
google的android中有个OpenGL ES + ......
写了个测试程序如下
struct hostent *hp;
char AlarmDevIP[20];
int x2;
hp = gethostbyname("www.google.com");
if (hp)
{
......
#include"stdio.h"
#include"stdlib.h"
void ContrTwo(char i)
{
char str1[8];
itoa(i,str1,2);
printf("%s",str1);
}
unsigned char leftRot(char str,int i);
unsign ......
我只学过清华蓝封面的C语言基础,想更深入的学习,该看什么书好?
C Primer Plus
C程序设计语言(第2版新版)
C语言程序设计_现代方法
C语言参考手册第五版
C语言大全
C和指针
C陷阱与缺陷
C专家编程
......