源程序:
#include "windows.h"
#include "stdio.h"LRESULT CALLBACK WindowSunProc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
WNDCLASS wndcls;
wndcls.cbClsExtra=0;
wndcls.cbWndExtra=0;
wndcls.hbrBackground=(HBRUSH)GetStockObject(BLACK_PEN);
wndcls.hCursor=LoadCursor(NULL,IDC_HELP);
wndcls.hIcon=LoadIcon(NULL,IDI_HAND);
wndcls.hInstance=hInstance;
wndcls.lpfnWndProc=WindowSunProc;
wndcls.lpszClassName="zqClass";
wndcls.lpszMenuName=NULL;
wndcls.style=CS_VREDRAW|CS_HREDRAW;
RegisterClass(&wndcls);
HWND hwnd;
hwnd=CreateWindow("zqClass","哥的一个程序",WS_OVERLAPPEDWINDOW,
0,0,600,400,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);
MSG msg;
while (GetMessage(&msg,hwnd,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK WindowSunProc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg) {
case WM_CHAR:
char zqChar[20];
sprintf(zqChar,"Char is %d",wParam);
MessageBox(hwnd,zqChar,"zqzq",0);
break;
case WM_LBUTTONDOWN:
MessageBox(hwnd,"DOWN","zq1",0);
HDC hdc;
hdc=GetDC(hwnd);
TextOut(hdc,0,50,"合肥工业大学",strlen("合肥工业大学"));
ReleaseDC(hwnd,hdc);
break;
case WM_PAINT:
HDC hdcz;
PAINTSTRUCT ps;
hdcz = BeginPaint(hwnd,&ps);
TextOut(hdc,0,100,"1111",strlen("1111"));
EndPaint(hwnd,&ps);
break;
case WM_CLOSE:
if (IDYES==MessageBox(hwnd,"QUIT?!~~","quit",MB_YESNO))
{
DestroyWindow(hwnd);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}点下BUILD后出现的信息--------------------Configuration: first - Win32 Release--------------------
Linking...
LIBC.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Release/first.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Creating browse info file...first.exe - 2 error(s), 0 warning(s)
这是怎么回事哎,谢谢各位了
#include "windows.h"
#include "stdio.h"LRESULT CALLBACK WindowSunProc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
WNDCLASS wndcls;
wndcls.cbClsExtra=0;
wndcls.cbWndExtra=0;
wndcls.hbrBackground=(HBRUSH)GetStockObject(BLACK_PEN);
wndcls.hCursor=LoadCursor(NULL,IDC_HELP);
wndcls.hIcon=LoadIcon(NULL,IDI_HAND);
wndcls.hInstance=hInstance;
wndcls.lpfnWndProc=WindowSunProc;
wndcls.lpszClassName="zqClass";
wndcls.lpszMenuName=NULL;
wndcls.style=CS_VREDRAW|CS_HREDRAW;
RegisterClass(&wndcls);
HWND hwnd;
hwnd=CreateWindow("zqClass","哥的一个程序",WS_OVERLAPPEDWINDOW,
0,0,600,400,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);
MSG msg;
while (GetMessage(&msg,hwnd,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK WindowSunProc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg) {
case WM_CHAR:
char zqChar[20];
sprintf(zqChar,"Char is %d",wParam);
MessageBox(hwnd,zqChar,"zqzq",0);
break;
case WM_LBUTTONDOWN:
MessageBox(hwnd,"DOWN","zq1",0);
HDC hdc;
hdc=GetDC(hwnd);
TextOut(hdc,0,50,"合肥工业大学",strlen("合肥工业大学"));
ReleaseDC(hwnd,hdc);
break;
case WM_PAINT:
HDC hdcz;
PAINTSTRUCT ps;
hdcz = BeginPaint(hwnd,&ps);
TextOut(hdc,0,100,"1111",strlen("1111"));
EndPaint(hwnd,&ps);
break;
case WM_CLOSE:
if (IDYES==MessageBox(hwnd,"QUIT?!~~","quit",MB_YESNO))
{
DestroyWindow(hwnd);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}点下BUILD后出现的信息--------------------Configuration: first - Win32 Release--------------------
Linking...
LIBC.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Release/first.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Creating browse info file...first.exe - 2 error(s), 0 warning(s)
这是怎么回事哎,谢谢各位了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货