create a rendering context in Win32

Hi,

I want to create a rendering context in Win32 for a whole screen but both of the following pieces of code always return. Do you know why? Please help. Thanks. Tony

// Piece 1
CWnd *pWnd = AfxGetMainWnd();
CWindowDC dc(pWnd);
HGLRC hrc = wglCreateContext(dc.m_hDC);
if (!hrc)
return;

// Piece 2
CWindowDC dc(NULL);
HGLRC hrc = wglCreateContext(dc.m_hDC);
if (!hrc)
return;

You need to set the pixel format of the window to PFD_SUPPORT_OPENGL, amongst other attributes.
Look up SetPixelFormat and PIXELFORMATDESCRIPTOR.