LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DiscardPannel calls pannel control callback function

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?

0 Kudos
Message 1 of 2
(2,937 Views)

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.

 

Message 2 of 2
(2,934 Views)