Error C2360: Initialization of 'hdc' is skipped by 'case' label

When a variable is declared in one case, the next case is technically still in the same scope so you could reference it there but if you hit that case without hitting this one first you would end up calling an uninitialised variable. This error prevents that.

All you need to do is either define it before the switch statement or use curly braces { } to make sure it goes out of scope before exiting a specific case.

switch (msg) {
    case WM_PAINT:
    {
        HDC hdc;
        hdc = BeginPaint(hWnd, &ps);
    } 
    break;
}

The first is legal and the second isn't. Skipping a declaration without an initializer is sometimes allowed, but never one with an initializer.

See Storage allocation of local variables inside a block in c++.