resources.h内容如下:
#define ID_CURSOR_CROSSHAIR 100
#define ID_ICON             200
resource.rc内容如下:
ID_CURSOR_CROSSHAIR CURSOR 我的第一个光标.cur(已建好的)
ID_ICON             ICON   我的第一个图标.cur(已建好的)
光标和图标.cpp内容如下:
#include<windows.h>
#include<stdio.h>
#include"resources.h"
LRESULT CALLBACK WinAnProc(HWND hwnd,
    UINT uMsg,
    WPARAM wParam,
    LPARAM lParam
);
int WINAPI WinMain(HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow
)
{
WNDCLASS wndclass;
wndclass.style=CS_HREDRAW|CS_VREDRAW;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.hCursor=LoadCursor(hInstance,MAKEINTRESOURCE(ID_CURSOR_CROSSHAIR));
wndclass.hIcon=LoadIcon(hInstance,MAKEINTRESOURCE(ID_ICON));
wndclass.hInstance=hInstance;
wndclass.lpfnWndProc=WinAnProc;
wndclass.lpszClassName="我的第一个WIN32程序";
wndclass.lpszMenuName=NULL;
    RegisterClass(&wndclass);

HWND hwnd;
hwnd=CreateWindow("我的第一个WIN32程序","我的第一个窗口",WS_OVERLAPPEDWINDOW|WS_VISIBLE,0,0,600,400,0,0,hInstance,0);
MSG msg;
while(TRUE)
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
   { 
   if (msg.message == WM_QUIT)
           break;
   TranslateMessage(&msg);
   DispatchMessage(&msg);
   } 

return(msg.wParam);
 
}
LRESULT CALLBACK WinAnProc(HWND hwnd,
    UINT uMsg,
    WPARAM wParam,
    LPARAM lParam
)
{
switch(uMsg)
{
case WM_CHAR:
char szChar[20];
sprintf(szChar,"这个字符是%d",wParam);
MessageBox(hwnd,szChar,"按下的键",0);
break;
case WM_LBUTTONDOWN:
MessageBox(hwnd,"你按了左键","按下的鼠标键",0);
HDC hdc;
hdc=GetDC(hwnd);
TextOut(hdc,0,50,"加了一行文字",strlen("加了一行文字"));
ReleaseDC(hwnd,hdc);
break;
case WM_PAINT:
HDC hDC;
PAINTSTRUCT ps;
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);
ExitProcess(0);
break;
default:
return(DefWindowProc(hwnd,uMsg,wParam,lParam));
}
return 0;
}
问题:怎么加载不成功呢?