C++ RegisterClass失败,错误代码为2

C++ RegisterClass失败,错误代码为2,c++,winapi,registerclass,C++,Winapi,Registerclass,我正在为我正在制作的程序创建一个启动,但是RegisterClass一直失败(2:系统找不到指定的文件) 我的代码是: WNDCLASS wc = {0}; wc.lpfnWndProc = DefWindowProc; wc.hInstance = g_hinstance; wc.hCursor = LoadCursor(NULL, IDC_ARROW); if (wc.hCursor == NULL) { #ifdef DEBUG log_debug("ShowSplash:Crea

我正在为我正在制作的程序创建一个启动,但是RegisterClass一直失败(2:系统找不到指定的文件)

我的代码是:

WNDCLASS wc = {0};
wc.lpfnWndProc = DefWindowProc;
wc.hInstance = g_hinstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
if (wc.hCursor == NULL)
{
#ifdef DEBUG
    log_debug("ShowSplash:CreateSplashWindow: LoadCursor failed: %d", GetLastError());
#endif
    return NULL;
}
wc.lpszClassName = classname;
if (RegisterClass(&wc) == 0);
{
#ifdef DEBUG
    log_debug("ShowSplash:CreateSplashWindow: RegisterClass failed: %d", GetLastError());
#endif
    return NULL;
}
g_hinstance
hinstance
DllMain
获取的

classname
是窗口类的名称

这行末尾有一个分号:

if (RegisterClass(&wc) == 0);

错误代码实际上来自前一个调用,但由于额外的分号,该块总是被执行。

Ahh。我想问题出在这方面。只是没有注意到分号