C++ RegisterClassEx Error : I am trying to learn Win32 through msdn but I am having problems with RegisterClassEx, I checked other threads stating that maybe not all members are initialized but I am sure they are.


    #include <Windows.h>
    #include <tchar.h>

    static const TCHAR windowclass_sz[] = _T("WindowClass1");
    static const TCHAR windowtitle_sz[] = _T("DirectX 12 Demo");

    bool Stop = true;


    LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM 
    lParam)
    {
	switch (message)
	{
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
    }

    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE PrevhInstance, LPSTR 
    lpCmdLine, int nCmdShow)
    {
	MSG msg;
	HWND hWnd;

	WNDCLASSEX wcex;
	ZeroMemory(&wcex, sizeof(WNDCLASSEX));
	wcex.cbSize = sizeof(WNDCLASSEX);
	wcex.cbClsExtra = 0;
	wcex.cbWndExtra = 0;
	wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
	wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
	wcex.hIcon = LoadIcon(hInstance, IDI_APPLICATION);
	wcex.hIconSm = LoadIcon(wcex.hInstance, IDI_APPLICATION);
	wcex.hInstance = hInstance;
	wcex.lpfnWndProc = WndProc;
	wcex.lpszClassName = windowclass_sz;
	wcex.lpszMenuName = nullptr;
	wcex.style = CS_HREDRAW | CS_VREDRAW;

	RegisterClassEx(&wcex);
	if (!RegisterClassEx(&wcex))
	{
		GetLastError();
		MessageBox(NULL, _T("RegisterClassEx Call Error!"), _T("ERROR"), 
     MB_ICONERROR && MB_OK );
		return 1;
	}

	hWnd = CreateWindowEx(NULL, windowclass_sz, windowtitle_sz, 
    WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
	 800, 600, NULL, NULL, hInstance, NULL);

	if (!hWnd)
	{
		MessageBox(NULL, _T("CreateWindowEx Call Error!"), _T("ERROR"), 
     MB_ICONERROR && MB_OK);
		return 1;
	}
	else
	{
		Stop = false;
	}

	ShowWindow(hWnd, nCmdShow);
	UpdateWindow(hWnd);

	while (Stop == false)
	{
		if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}

	}

	return (int)msg.wParam;
    }

As you can see, the RegisterClassEx error is triggered but I have no clue what is wrong.