Closing from the Task Bar is not like closing a panel. It is sending a Windows message to destroy the process. Say for example, you have 5 panels. Each time you pressed the X at the top right, you would just be closing that window. To handle Windows messages destroying the process, you need to install a main callback (callback for the process). There is an EVENT_END_TASK that handles the WM_DESTROY event to the application. Below is a basic example.
int CVICALLBACK MainCB (int panelOrMenuBarHandle,
int controlOrMenuItemID,
int event, void *callbackData, int eventData1,
int eventData2);
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
re
turn -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "close.uir", PANEL)) < 0)
return -1;
InstallMainCallback (MainCB, 0, 1);
DisplayPanel (panelHandle);
RunUserInterface ();
DiscardPanel (panelHandle);
return 0;
}
int CVICALLBACK MainCB (int panelOrMenuBarHandle,
int controlOrMenuItemID,
int event, void *callbackData, int eventData1,
int eventData2)
{
switch (event)
{
case EVENT_END_TASK:
MessagePopup ("Test", "Test");
break;
}
return 0;
}
Best Regards,
Chris Matthews
Measurement Studio Support Manager