这是它在第 33 页给我的代码:
#include<Windows.h>
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE prevInstance,
LPWSTR cmdLine, int cmdShow)
{
UNREFERENCED_PARAMETER( prevInstance );
UNREFERENCED_PARAMETER( cmdLine );
WNDCLASSEX wndClass = { 0 };
wndClass.cbSize = sizeof( WNDCLASSEX ) ;
wndClass.style = CS_HREDRAW | CS_VREDRAW;
wndClass.lpfnWndProc = WndProc;
wndClass.hInstance = hInstance;
wndClass.hCursor = LoadCursor( NULL, IDC_ARROW );
wndClass.hbrBackground = ( HBRUSH )( COLOR_WINDOW + 1 );
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = "DX11BookWindowClass";
if( !RegisterClassEx( &wndClass ) )
return -1;
RECT rc = { 0, 0, 640, 480 };
AdjustWindowRect( &rc, WS_OVERLAPPEDWINDOW, FALSE );
HWND hwnd = CreateWindowA( "DX11BookWindowClass", "Blank Win32 Window",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc.
left,
rc.bottom - rc.top, NULL, NULL, hInstance, NULL );
if( !hwnd )
return -1;
ShowWindow( hwnd, cmdShow );
return 0;
}
这段代码给了我2个错误-
1>----- 构建开始:项目:BlankWindow,配置:Debug Win32 ------ 1> main.cpp 1>c:\coding\c++\visual c++\directx\blankwindow\blankwindow\main. cpp(10): 错误 C2065: 'WndProc' : 未声明的标识符 1>c:\coding\c++\visual c++\directx\blankwindow\blankwindow\main.cpp(15): 错误 C2440: '=' : 无法从 ' 转换const char [20]' to 'LPCWSTR' 1> 指向的类型不相关;转换需要 reinterpret_cast、C 样式转换或函数样式转换 ========== 构建:0 成功,1 失败,0 最新,0 跳过 ==========
基本上
“WndProc”:未声明的标识符和“=”:无法从“const char [20]”转换为“LPCWSTR”
这段代码有什么问题?