A problem on multithread OpenGL program on Windows98

I am now developing an OpenGL application on Windows98 system with Visual C++.
First I built a class derived from CThreadWnd with distinct render context (GLHRC) in it. I test this class in a single view program and find it does work quite well.
But when I use it in a multi-view(actually a splitter window),every view’s device context is relative to one thread class.
But when the program is running, it always
collapse, often make my system dead.

I take great effort to overwhelm this problem, but fail again and again. (
So I came here looking for help.

Thanks.

I would stay away from threads unless you really need to use them. It takes some time to switch tasks, plus it makes your code more complex and harder to debug.

If you must, it sounds like your device context is in a shared memory segment that all threads are trying to use. Try to create a new context for each thread. Not quite sure of any windows device context issues, because I mainly code in un|x.

/skw|d

Originally posted by skw|d:
[b]I would stay away from threads unless you really need to use them. It takes some time to switch tasks, plus it makes your code more complex and harder to debug.

If you must, it sounds like your device context is in a shared memory segment that all threads are trying to use. Try to create a new context for each thread. Not quite sure of any windows device context issues, because I mainly code in un|x.

/skw|d[/b]

Thanks.
But I am now working on Win98, no other choice, it’s my work (
In my program, device context seems not shared. They should be distinctive for each view window.
And, I have try to avoid use the origin device context. So I create a new device context( memory DC) and create a bitmap and select the map to the dc.
But error emerges when program run to the the function SetPixelFormat, why does this happen?
I am really confused. sigh

I’m not sure, try to see if you can print out the address of the device contexts. See if they have the same address or invalid addresses.

/skw|d