views:

12

answers:

1

I am creating a splash for a program that I'm making but RegisterClass keeps on failing (2: The system cannot find the file specified.)

My code is this:

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 is the HINSTANCE DllMain gets
classname is the name of the window class

+1  A: 

There's a stray semicolon at the end of this line:

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

The error code is actually from some previous call, but the block always gets executed because of the extra semicolon.

casablanca
Ahh. I thought something related to that was the problem. Just didn't notice the semicolon there Xp
kotarou3