win32做API的时候出错了,哪位大神帮忙改一下,或者说一下
#include <Windows.h>#include <tchar.h>
LRESULT CALLBACK WndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM mParam);
const TCHAR szWindowClass[]=L"第一个窗口";
const TCHAR szWindowTitle[]=L"主窗口题目";
int WINAPI_tWinMain(HINSTANCE hInstance,HINSTANCE hPreInstance,LPTSTR lpCmdLine,int nCmdShow)
{
WNDCLASSEX wcex={ 0 };
wcex.cbSize=sizeof(WNDCLASSEX);
wcex.style=CS_HREDRAW|CS_VREDRAW;
wcex.lpfnWndProc=(WNDPROC)WndProc;
wcex.hInstance=hInstance;
wcex.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wcex.hCursor=LoadCursor(NULL,IDC_ARROW);
wcex.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wcex.lpszClassName=szWindowClass;
RegisterClassEx(&wcex);
HWND hWnd=CreateWindow(szWindowClass,
szWindowTitle,
WS_OVERLAPPEDWINDOW,
100,200,500,500,
HWND_DESKTOP,
NULL,
hInstance,
NULL);
if(!hWnd)
return FALSE;
ShowWindow( hWnd,nCmdShow);
UpdateWindow(hWnd);
MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch(msg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hWnd,msg,wParam,lParam);
}
}
————————————————————————————————————————————————————————————————————————————错误:
错误 1 error LNK2019: 无法解析的外部符号 _main,该符号在函数 ___tmainCRTStartup 中被引用 E:\Games\00320\00320\MSVCRTD.lib(crtexe.obj) 00320