07-12-2012 07:36 AM
I am using labWindows 5.5. Why DiscardPannel(...) call panel's callback function? This would causes GPF (memory general protection failed) because panel handle became invalid when the panel callback had some calls used panel handle value. How do I check if panel handle is visible?
07-12-2012 08:26 AM
When the panel is discarded the callback function is called with an EVENT_DISCARD. A quick fix for your problem would be to add
if(event == EVENT_DISCARD)
return 0;
at the beginning of the callback which will stop whatever code is causing problems from running. The proper solution would be to always check the passed event parameter and only respond to the appropiate events (EVENT_LEFT_CLICK, EVENT_GOT_FOCUS, etc. or whatever you need to respond to). This is important if you ever upgrade CVI as never versions of CVI will have new event types that will call the callback function which could cause problems if the callback function ignores the event parameter.