error C2065: 'IDI_ICON' : undeclared identifier Error executing cl.exe.

我写了一段代码:
#include<windows.h>
#include<stdio.h>

LRESULT CALLBACK wndproc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);

int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
)
{
char szApp[]="changlong";
WNDCLASS wnd;
wnd.cbClsExtra=0;
wnd.cbWndExtra=0;
wnd.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wnd.hCursor=LoadCursor(NULL,IDC_APPSTARTING);
wnd.hIcon=LoadIcon (hInstance, MAKEINTRESOURCE (IDI_ICON));
wnd.hInstance=hInstance;
wnd.lpfnWndProc=wndproc;
wnd.lpszClassName=szApp;
wnd.lpszMenuName=NULL;
wnd.style=CS_VREDRAW | CS_HREDRAW;
RegisterClass(&wnd);
HWND hwnd;
hwnd=CreateWindow(szApp,"练习",WS_OVERLAPPEDWINDOW | WS_VSCROLL,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOWNORMAL);
MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK wndproc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
HICON hIcon;
int cxIcon,cyIcon;
HINSTANCE hInstance;
PAINTSTRUCT ps;
switch(uMsg)
{
case WM_CREATE:
hInstance = ((LPCREATESTRUCT) lParam)->hInstance ;
hIcon=LoadIcon(hInstance,MAKEINTRESOURCE(IDI_ICON));
cxIcon=GetSystemMetrics(SM_CXICON);
cyIcon=GetSystemMetrics(SM_CYICON);
break;
case WM_PAINT:
HDC hdc;
hdc=BeginPaint(hwnd,&ps);
TextOut(hdc,0,0,"我是昌龙,,,,",strlen("我是昌龙,,,,"));
EndPaint(hwnd,&ps);
break;
case WM_CLOSE:
if(IDYES==MessageBox(hwnd,"是否要退出程序!","关闭",MB_YESNO))
{
DestroyWindow(hwnd);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}
为什么老是出现 error C2065: 'IDI_ICON' : undeclared identifier Error executing cl.exe.
.rc资源文件我也做了,图标也做了就是不能编译,大虾们帮帮忙...

#include "resource.h"
温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网