Handling Invalid hrefnum for Capture History
jjweimer
In my application, when my experiment is closed and then reopened, a particular state remembers that it should be capturing history, but the hrefnum is invalid. How can I prevent a call to CaptureHistory(hrefnum,1) from putting up a dialog about an invalid hrefnum? Can this be done within a try-catch-endtry block? My other alternative appears to be a hook before closing or at startup of the experiment to set my global to shut off the history capture.
Essentially, I would be wanting the equivalent of a /Z flag on CaptureHistory(...) as is so handy on operations to catch an error flag and handle it internally.
You should be able to use an AfterFileOpenHook function to set your refNum to zero when an experiment is opened. Then test if it is zero before using it.
July 11, 2011 at 02:13 pm - Permalink
Oh ... I wasn't intending to stretch it to break things. I've handled the issue as you suggested with a AfterFileOpenHook() call.
Thanks.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
July 11, 2011 at 07:13 pm - Permalink