When I run this code:

window_handle = CreateWindow("OpenGL", title, style, 0, 0, width, height, NULL, NULL, window_instance, NULL);

	if (!window_handle)
	{
		GL_KillWindow ();
		MessageBox (NULL, "Window creation error", "ERROR", MB_OK | MB_ICONEXCLAMATION);
		return false;
	}

CreateWindow returns NULL. What are the reasons that could cause CreateWindow to fail?

When I use GetLastError (), it returns 1400 which means "Invalid window handle", how could I fix this?

Look at this tutorial and maybe it will tell you what you are doing wrong.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.