03-29-2006 07:38 AM
03-29-2006 08:51 AM
03-29-2006 10:26 AM
03-29-2006 05:30 PM
03-30-2006 12:53 AM
Thank you All, but I'm still having problems.
Here below there is a simple example of what I do to catch the Close Event:
#include <utility.h>
#include <cvirte.h>
#include <userint.h>
#include "ApplClose.h"
static long int hMain;
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if ((hMain = LoadPanel (0, "ApplClose.uir", MAIN)) < 0)
return -1;
DisplayPanel (hMain);
RunUserInterface ();
DiscardPanel (hMain);
return 0;
}
int CVICALLBACK MainWnd (int panel, int event, void *callbackData,
int eventData1, int eventData2)
{
switch (event)
{
case EVENT_CLOSE:
MessagePopup ("ApplClose", "Close Event trapped!");
QuitUserInterface (0);
break;
}
return 0;
}
The UIR file has a void panel, where the panel callback is MainWnd().
This works if I close the application clicking the [X] on the application title bar or if I type Alt+F4 while my application has the focus.
If I close the application using Task Manager or pressing the right click on it (on the Windows task bar) then selecting Close, the application closes without displaying me the MessagePopup().
Merv, how can I access "panel properties" in the UIR file? I'm working with CVI 7.0 and I didn't find the way.
Again, thanks.
03-30-2006 03:57 AM
Hi,
Try InstallMainCallback(..) and EVENT_END_TASK. See Labwindows/CVI help for deails.
03-30-2006 04:47 AM
03-30-2006 05:06 AM
Thank you All,
It does work!