problem with OpenGL-Window Class

Hi,

i have a problem with a class, which has to create and draw an OpenGl-Window (Parent: CWnd).
I use this class in a MFC-prog with two dialogs(a main dialog with three of these OpenGl-Windows and a second startet from the main dialog with an additional OpenGl-Window).
In the past i comiled a some GL-comands into a Displaylist and called this one if needed and everything worked fine. Now i’ve some problems with this displaylist in connection with the textfontdisplaylist from the NEHE-tutorial. i noticed that the fonts are only displayed when i remove my own Displaylist. But then i’ve another problem: the main dialog works correct, but when i open the second dialog(modal or demodal) in my program the whole program sleeps and i have to close it with ALT+F4.
when i undo the displaylist-changes the program works fine but i can’t see the fonts.
Can anybody help me with this problem?

Thx

Sebastian

Here are the important parts of my code(some comments are in German, but only MFC-stuff):

class-declaration:

class COglDiag : public CWnd
{
public:
COglDiag(bool rt);
void ClearDiag();
void Set_Start(bool single);
void Set_Time(double t);
void NewPoint(double value);
void SetTimeScale(double t);
void SetValueScale(double maxmin);
void mark_point(double time, double value);

// Attribute
public:

// Operationen
public:

// Überschreibungen
// Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen
//{{AFX_VIRTUAL(COglDiag)
//}}AFX_VIRTUAL

// Implementierung
public:
virtual ~COglDiag();

// Generierte Nachrichtenzuordnungsfunktionen 

protected:
//{{AFX_MSG(COglDiag)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnPaint();
afx_msg void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()

HDC hdc; 
HGLRC hglrc; 
OglDiagFeat* p_prop; 
bool start_diag, realtime; 
void DrawAxes(); 
double last_value, nrt_last_time, nrt_akt_time, nrt_diag_start_time; 

double transformt(double t); 
double transformv(double v); 
double GetEqualScale(double n); 

double max_value, min_value; 
CString time_name, time_unit, value_name, value_unit; 

#if 1
enum GLDisplayListNames
{
coord=1
};
#endif
};


now the OnCreate-function:

int COglDiag::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;

MySetPixelFormat(::GetDC(m_hWnd)); //function that sets the Pixelformatdescriptor
hdc = ::GetDC(m_hWnd);
hglrc = wglCreateContext(hdc);
wglMakeCurrent(hdc, hglrc);

glClearColor(1.0, 1.0, 1.0, 0);
glColor3f(0.0, 0.0, 0.0);

glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
wglMakeCurrent(NULL, NULL) ;

return 0;
}


and last but not least the function where die Displaylist ist created an called. This function is called from another function, which calls wglMakeCurrent(hdc, hglrc) , …(NULL, NULL), Swapbuffers …

void COglDiag: rawAxes()
{
start_diag=true;

#if 1
if (p_prop->scale_modified)
{
p_prop->scale_modified=false;

    glDeleteLists(coord, 1); 
     
    glNewList(coord, GL_COMPILE_AND_EXECUTE); 

#endif
glColor3f(0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        glLineWidth(2.0); 
        glBegin(GL_LINES); 
            glVertex2d(xt0, yv0-yv_max-0.05); 
            glVertex2d(xt0, yv0+yv_max+0.15); 
        glEnd(); 
        glBegin(GL_TRIANGLES); 
            glVertex2d(xt0, yv0+yv_max+0.25); 
            glVertex2d(xt0-0.03, yv0+yv_max+0.05); 
            glVertex2d(xt0+0.03, yv0+yv_max+0.05); 
        glEnd(); 
        glBegin(GL_LINES); 
            glVertex2d(xt0, yv0); 
            glVertex2d(xt_max+0.05, yv0); 
        glEnd(); 
        glBegin(GL_TRIANGLES); 
            glVertex2d(xt_max+0.2, yv0); 
            glVertex2d(xt_max+0.05, yv0+0.05); 
            glVertex2d(xt_max+0.05, yv0-0.05); 
        glEnd(); 
        glLineWidth(1.0); 
        for (int zz=1; zz<=10; zz++) 
        { 
            glBegin(GL_LINES); 
                glVertex2d(xt0+(double)zz/10*(xt_max-xt0), yv0); 
                double d; 
                if (zz % 2==0) d=yv0-0.1; 
                else d=yv0-0.05; 
                glVertex2d(xt0+(double)zz/10*(xt_max-xt0), d); 
            glEnd(); 
        } 
        for (zz=0; zz<=8; zz++) 
        { 
            glBegin(GL_LINES); 
                glVertex2d(xt0, transformv((double)(-4+zz)/8*(max_value-min_value))); 
                double d; 
                if (zz % 2==0) d=xt0-0.05; 
                else d=xt0-0.025; 
                glVertex2d(d, transformv((double)(-4+zz)/8*(max_value-min_value))); 
            glEnd(); 
        } 

#if 1
glEndList();

} 
else glCallList(coord); 

#endif
p_prop->time_reset=false;
}