Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am destroying GraphView Window Created By Me On Clear Button,
Code Works Fine In Debug Mode But Crashes In Release Mode.
Please Help


C++
if(IsWindow(objTabCalibrationResult->m_pGraph->m_hWnd))
           objTabCalibrationResult->m_pGraph->DestroyWindow();
Posted
Comments
Richard MacCutchan 13-Feb-13 4:51am    
This needs a lot more detail; we cannot guess from the above what may be happening.
adityarao31 13-Feb-13 9:34am    
If I remove these two line code works absolutely fine in release mode also
Richard MacCutchan 13-Feb-13 11:28am    
Well, there's your solution.
adityarao31 13-Feb-13 13:03pm    
But I require to clear graph
Richard MacCutchan 13-Feb-13 13:24pm    
Well you need to provide a lot more details of what you are trying to do and what your code is doing. As it stands we cannot guess what is going on.

1 solution

My Problem got solved by using IsBadReadPtr Function.I thanks to every one who tried to solve the problem

C++
if(!::IsBadReadPtr(m_pGraph,1))
    if(IsWindow(m_pGraph->m_hWnd))
        m_pGraph->DestroyWindow();
}
 
Share this answer
 
Comments
CPallini 14-Feb-13 4:34am    
You may find interesting this documentation page:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366713(v=vs.85).aspx
Richard MacCutchan 14-Feb-13 4:59am    
If you just want to clear the client area of the Window, then you should set a flag, or clear all the data of the graph, then use InvalidateWindow(). Then in your paint function you should check if a graph exists and do nothing if there is no data. That will automatically clear the graph from the window.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900