• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 242
  • Last Modified:

Problem with my small window program with opengl graphic in it

I wrote a windowing class in C++ to create windows.  I'm a newbie to C++ and Windows programming.  The
small program I wrote uses the windowing class to create a window and put an opengl cube in it.

My problem is this: Every once in a while, the program doesn't shutdown properly (remains in task list).
 This could be due to one of 2 things as far as I can tell:

1)  My code sucks
2)  I added the ability to toggle from fullscreen to windowed mode (and vice versa).  Using SetWindowLong,
I give the window a new style.  I'm thinking that maybe this changes the hWnd, so because I can't/don't
update the device context and rendering contexts, when it comes time to shutdown and I call like ReleaseDC(hWnd,
hDC), it might not work properly.

I've been posting this in a few OpenGL forum but they aren't much help.    

I've posted my source at:

http://members.home.net/l-reynolds/myCode.zip

I wrote the code using VC++ 6.

Any help and/or suggestions, code modifications(even unrelated to my current problem) or whatever can
be sent to l-reynolds@home.com as well as posted here.

Thanks in advance...
0
Sketchy
Asked:
Sketchy
  • 3
  • 2
1 Solution
 
ambienceCommented:
this solved the problem

case WM_KILLFOCUS:
{
     //WaitMessage();  // comment this one
     return(0);
}

try it out and tell me
0
 
SketchyAuthor Commented:
What sucks is that its really hard to tell when the problem is there or not.  

I thought WaitMessage might be the problem, so I commented it out earlier, and I didn't get any crashes.  So I uncommented it to see if then I would get a crash, but I still didn't.  For the life of me I couldn't get it to crash.

One other thing I noticed is that if you are in windowed mode and you move the mouse onto the title bar, like back and forth over the icons in the top right, then after a while the cube will stutter in its motion (like it lagged or something), just one time.  I thought that was pretty weird.  It should maintain a fluid continuous rotation.    
0
 
SketchyAuthor Commented:
oh BTW why do you think that the waitmessage is the problem?  Is it being called right before the destruction of the window or something?

But if that were the case, wouldn't it happen every time?

 
0
 
SketchyAuthor Commented:
Ok I'm halfa$$ retarded.  The stuttering I mentioned happens because I have the cursor over the MINIMIZE button, and the little textbox is popping up and lagging it for a second.  It has nothing to do with my code problems...
0
 
ambienceCommented:
hmm .... wont your code get stuck at WaitMessage because it executes at KillFocus , the last killfocus(one due to window closing) would cause the app to wait for another message to come , which wouldn't come normaly .... however while debugging there is no such problem which i think is because of minimizing the app and bringing the debugger infront...

i maybe wrong , correct me if i am wrong ...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now