各位哥哥姐姐好,一个小小问题
#include<windows.h>
#include<resource.h>
LRESULT CALLBACK WndProc (HWND , UINT ,
WPARAM , LPARAM ) ;
int WINAPI WinMain ( HINSTANCE hInstance ,HINSTANCE hPrevInstance,LPSTR lpcmdLine ,int nCmdShow)
{
static TCHAR szAppName[] = TEXT( " HelloWorld " ) ;
static TCHAR szClassName[] = TEXT( " HelloWorldClass " );
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (hInstance,MAKEINTRESOURCE(IDI_ICON1)) ;
wndclass.hCursor = LoadCursor (hInstance,MAKEINTRESOURCE(IDC_CURSOR1)) ;
wndclass.hbrBackground = ( HBRUSH ) GetStockObject ( WHITE_BRUSH ) ;
//wndclass.LpszMenuName = NULL ;
wndclass.lpszClassName = szClassName;
RegisterClass(&wndclass);
hwnd = CreateWindow ( szClassName,TEXT("My Hello World to Windows Program") ,WS_OVERLAPPEDWINDOW ,CW_USEDEFAULT , CW_USEDEFAULT , CW_USEDEFAULT ,CW_USEDEFAULT , NULL ,NULL ,hInstance , NULL ) ;
ShowWindow (hwnd , nCmdShow ) ;
UpdateWindow ( hwnd ) ;
while ( GetMessage ( & msg , NULL , 0 , 0 ) )
{
TranslateMessage ( &msg ) ;
DispatchMessage ( &msg) ;
}
return msg. wParam ;
}
LRESULT CALLBACK WndProc ( HWND hwnd , UINT message ,WPARAM wParam ,LPARAM lParam )
{
HDC hdc ;
PAINTSTRUCT ps ;
RECT rect ;
switch ( message )
{
case WM_CREATE :
MessageBox( NULL , " Hello World!" , "Hello World " , MB_OK) ;
MessageBeep ( MB_OK ) ;
return 0 ;
case WM_PAINT:hdc = BeginPaint ( hwnd , &ps ) ;
GetClientRect ( hwnd , &rect ) ;
DrawText ( hdc , TEXT ( "Hello , Windows !") , -1 , &rect ,DT_SINGLELINE | DT_CENTER| DT_VCENTER) ;
EndPaint ( hwnd , &ps ) ;
return 0 ;
case WM_DESTROY :
PostQuitMessage ( 0 ) ;
return 0 ;
}
return DefWindowProc ( hwnd , message , wParam , lParam ) ;
}
------ 已启动生成: 项目: hohohoho, 配置: Debug Win32 ------
正在编译...
hohoho.cpp
c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\hohohoho\hohoho.cpp(20) : error C2065: “IDI_ICON1” : 未声明的标识符
c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\hohohoho\hohoho.cpp(21) : error C2065: “IDC_CURSOR1” : 未声明的标识符
c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\hohohoho\hohoho.cpp(38) : warning C4244: “return” : 从“WPARAM”转换到“int”,可能丢失数据
生成日志保存在“file://c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\hohohoho\Debug\BuildLog.htm”中
hohohoho - 2 错误,1 警告
---------------------- 完成 ---------------------
生成: 0 已成功, 1 已失败, 0 已跳过
然后如果强制运行的话,就会中断错误....之类的,怎么回事?