本演练是错误的[演练:创建Windows桌面应用程序(C ++)VS2015] https://msdn.microsoft.com/en-us/library/bb384843.aspx [英] This walkthrough is wrong [Walkthrough: Creating Windows Desktop Applications (C++) VS2015] https://msdn.microsoft.com/en-us/library/bb384843.aspx
问题描述
我按照演练进行了操作,但在
I followed the walkthrough and it failed at
if (!RegisterClassEx(&wcex))
我怀疑这是因为代码的这一行:
I suspect this happened because of this line of the code:
WNDCLASSEX wcex;
// WNDCLASSSEX结构的各种其他成员的初始化
//initialization of the various other members of the WNDCLASSSEX struct
wcex.lpszClassName = szWindowClass;
wcex.lpszClassName = szWindowClass;
因为标识符 szWindowClass 永远不会在代码中定义,从而产生编译错误,我试过这个:
since the identifier szWindowClass is never defined in code, thus giving a compilation error, I tried this:
wcex.lpszClassName = LPCTSTR("Win32 Walkthrough Window")
On a side note, is Windows API this esoteric on purpose or was the system architect on crack?
推荐答案
您没有注意到漫游代码声明变量的位置。  再看一下 -
You didn't notice where the walkthrough code declared the varialble. Look again for --
static TCHAR szWindowClass[] = _T("win32app");
static TCHAR szTitle[] = _T("Win32 Guided Tour Application");
这篇关于本演练是错误的[演练:创建Windows桌面应用程序(C ++)VS2015] https://msdn.microsoft.com/en-us/library/bb384843.aspx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!