High color/true color troubles on Win2000

Hi all. Usually, my computer is set to 1024x768, 32 bits. My code works ok, but when I switch to 16 bits, everything crashes. On one machine, it happens when I do this:

if(wglMakeCurrent(hdc, hrc) == false)
    ShowMessage("Could not MakeCurrent"); 

What’s disturbing is that both “hdc” and “hrc” are correct (they are produced by

  
hdc = GetDC(); 
SetPixelFormatDescriptor();
hrc = wglCreateContext(hdc);

)

Bad things (“project raised exception class C0000090”) happen inside wglMakeCurrent. Here’s my SetPixelFormat routine:

void __fastcall TFormMain::SetPixelFormatDescriptor()
{
  PIXELFORMATDESCRIPTOR pfd = {
    sizeof(PIXELFORMATDESCRIPTOR),
    1,
    PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
    PFD_TYPE_RGBA,
    24,     // 16 doesn't work either
    0,0,0,0,0,0,
    0,0,
    0,0,0,0,0,
    32, // other values don't work either
    0,
    0,
    PFD_MAIN_PLANE,
    0,
    0,0,0
  };

  PixelFormat = ChoosePixelFormat(hdc, &pfd);
  if (!SetPixelFormat(hdc, PixelFormat, &pfd)) ShowMessage("Pixel format not set");
}

I have Windows 2000 professional, SP4, code composed in Borland C++ Builder 6.0, Riva TNT-2. On another machine (same config, Ge-Force FX 5600) I get through the initialization, but everything crashes (same error code) on function “glRasterPos3f”.

It seems that it shouldn’t be so… When my monitor is set to 32 bits (true color), all is fine. Could anyone please point me out - why does this happen, or what could be done to fix this?

(Added later: I found an interesting thing. When I am running NeHe tutorials, made in Borland C++ Builder, I get the bad behavior as described above. But when I run the same tutorial, made in MS Visual C++, everything’s all right. One more mistery…)

I found out the reason! Quoted from
http://members.cox.net/scottheiman/opengl.htm

Math exceptions and access violations will occasionally cause your OpenGL applications to abort. By default, MS (Visual C++) ignores floating point exceptions; Borland does not. Add the following line to the initialization section of your code:

_control87(MCW_EM, MCW_EM);  /* defined in float.h */

It will disable Borland’s floating point exception handlers.
I did exactly that, and now everything works well. But still, why those fp exceptions happen in the first place?..

What are your drivers version ?

My Riva-TNT2 drivers are all version 6.14.10.5672.
What I’d like to stress is that EXE files compiled with Visual C++ work fine, while those compiled with Borland C++ Builder 5.0 work only if I set the monitor to 32 bits.