#include<windows.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define Pi 3.1415926
long WINAPI WndProc(HWND hWnd,UINT iMessage,UINT wParam,LONG lParam);
double dfTheta=0,dfRange=100.0;
long i=0,j=0;
long lCentreX=0,lCentreY=0,lRadious=(long)(0.2*dfRange);
POINT lpSin[100];
/*BOOL InitWindowsClass(HINSTANCE hInstance)
{
WNDCLASS WndClass;
WndClass.cbClsExtra=0;
WndClass.cbWndExtra=0;
WndClass.hbrBackground=(HBRUSH)(GetStockObject(WHITE_BRUSH));
WndClass.hCursor=LoadCursor(NULL,IDC_ARROW);
WndClass.hInstance=hInstance;
WndClass.hIcon=LoadIcon(NULL,”END”);
WndClass.lpfnWndProc=WndProc;
WndClass.lpszMenuName=NULL;
WndClass.lpszClassName=”WinFill”;
WndClass.style=CS_HREDRAW|CS_VREDRAW;
return RegisterClass(&WndClass);
}*/
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{MSG Message;
WNDCLASS WndClass;
HWND hWnd;
if(!RegisterClass(&WndClass))
{MessageBeep(0); return FALSE;}
hWnd=CreateWindow
(“sin”,
”moon”,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
0,
CW_USEDEFAULT,
0,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(hWnd,nCmdShow);
UpdateWindow(hWnd);
for(int j=0;j<100;j++)
{
lpSin[j].x=(long)(j*2*Pi/100*60);
lpSin[j].y=(long)(dfRange*sin(j*2*Pi/100));
}
while(GetMessage(&Message,0,0,0))
{
TranslateMessage(&Message);
DispatchMessage(&Message);
}
return Message.wParam;
}
long WINAPI WndProc(HWND hWnd,UINT iMessage,UINT wParam,LONG lParam)
{
HDC hDC;
HBRUSH hBrush;
HPEN hPen;
PAINTSTRUCT PtStr;
switch(iMessage)
{
case WM_PAINT:
hDC=BeginPaint(hWnd,&PtStr);
SetWindowOrgEx(hDC,-200,-200,NULL);
hPen=CreatePen(PS_DASH,1,RGB(255,0,0));
SelectObject(hDC,hPen);
Polyline(hDC,lpSin,100);
if(i<=25)
{
hPen=CreatePen(PS_DASH,1,RGB(255,0,0));
hBrush=CreateHatchBrush(HS_BDIAGONAL,RGB(255,0,0));
lRadious=(long)(dfRange*0.2+i%25*dfRange*0.4/25);
}
else if(i<=50)
{
hPen=CreatePen(PS_DASH,1,RGB(0,255,0));
hBrush=CreateHatchBrush(HS_BDIAGONAL,RGB(0,255,0));
lRadious=(long)(dfRange*0.2+i%25*dfRange*0.4/25);
}
else
{
hPen=CreatePen(PS_DASH,1,RGB(255,0,255));
hBrush=CreateHatchBrush(HS_BDIAGONAL,RGB(255,0,255));
lRadious=(long)(dfRange*0.2+i%25*dfRange*0.4/25);
}
SelectObject(hDC,hBrush);
SelectObject(hDC,hPen);
lCentreX=lpSin[i].x;
lCentreY=lpSin[i].y;
Ellipse(hDC,lCentreX-lRadious,lCentreY-lRadious,lCentreX+lRadious,lCentreY+lRadious);
i++;
DeleteObject(hPen);
DeleteObject(hBrush);
EndPaint(hWnd,&PtStr);
Sleep(100);
if(i<100) InvalidateRect(hWnd,NULL,1);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
default:return(DefWindowProc(hWnd,iMessage,wParam,lParam));
}
}
“圆.exe”: 已加载“D:\我的文档\Visual Studio 2005\Projects\圆\Debug\圆.exe”,已加载符号。
“圆.exe”: 已加载“C:\WINDOWS\system32\ntdll.dll”,未加载任何符号。
“圆.exe”: 已加载“C:\WINDOWS\system32\kernel32.dll”,未加载任何符号。
“圆.exe”: 已加载“C:\WINDOWS\system32\user32.dll”,未加载任何符号。
“圆.exe”: 已加载“C:\WINDOWS\system32\gdi32.dll”,未加载任何符号。
“圆.exe”: 已加载“C:\WINDOWS\system32\imm32.dll”,未加载任何符号。
“圆.exe”: 已加载“C:\WINDOWS\system32\advapi32.dll”,未加载任何符号。
“圆.exe”: 已加载“C:\WINDOWS\system32\rpcrt4.dll”,未加载任何符号。
“圆.exe”: 已加载“C:\WINDOWS\system32\secur32.dll”,未加载任何符号。
“圆.exe”: 已加载“C:\WINDOWS\system32\lpk.dll”,未加载任何符号。
“圆.exe”: 已加载“C:\WINDOWS\system32\usp10.dll”,未加载任何符号。
“圆.exe”: 已加载“C:\WINDOWS\system32\msvcrt.dll”,未加载任何符号。
程序“[3640] 圆.exe: 本机”已退出,返回值为 0 (0×0)。
出现这个问题,为什么????
>> 本文固定链接: http://www.vcgood.com/archives/3187