Solved

Problem with my small window program with opengl graphic in it

Posted on 2001-06-19
5
204 Views
Last Modified: 2006-11-17
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
Comment
Question by:Sketchy
  • 3
  • 2
5 Comments
 
LVL 22

Accepted Solution

by:
ambience earned 300 total points
ID: 6209098
this solved the problem

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

try it out and tell me
0
 

Author Comment

by:Sketchy
ID: 6209124
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
 

Author Comment

by:Sketchy
ID: 6209128
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
 

Author Comment

by:Sketchy
ID: 6209136
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
 
LVL 22

Expert Comment

by:ambience
ID: 6212838
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now