01-04-2007 04:07 PM
01-05-2007 07:58 AM
What version of CVI are you using?
Have you debugged your program by stepping through it to see which line is causing the problem?
Do you start your UI with RunUserInterface and end it with QuitUserInterface?
What do you do before exiting?
Are you trying to access any controls after discarding the panel or calling QuitUserInterface?
Can you post your exiting code (anything after RunUserInterface)?
01-05-2007 08:09 AM
01-05-2007 08:39 AM
So what line of code causes the problem?
I don't see anything that would obviously cause your problem. One thing I would suggest is to check for EVENT_COMMIT before calling QuitUserInterface(). Multiple events (e.g. EVENT_GOT_FOCUS, EVENT_LEFT_CLICK, EVENT_COMMIT) will fire for a click on Quit. You only need to call QuitUserInterface once, for EVENT_COMMIT.
I also don't recognize the prototype for your ProgramQuit function. Try the following.
int CVICALLBACK ProgramQuit (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
QuitUserInterface (0);
break;
}
return 0;
}
01-05-2007 08:45 AM
01-05-2007 08:51 AM
01-05-2007 08:53 AM
01-05-2007 09:03 AM
01-05-2007 09:21 AM
Several different events may be fired for controls other than the one clicked on. You should always check for EVENT_COMMIT before executing your code.
The event that may be causing you the most problem is EVENT_DISCARD which is sent to panels and controls when they are discarded.
Double check that all your callbacks (including but not limited to callbacks that call your update function) check for EVENT_COMMIT.
01-05-2007 10:29 AM
Hello,
The problem you are facing could be that you placed a line of code at the wrong place in a function. For example, the code below would run correctly but give you the exact warning you are talking about when you exit:
int CVICALLBACK RangePrint (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
char CellRangeValue[10]={"\0"};
GetCtrlVal(panelHandle, PANEL_MYCELLRANGE, CellRangeValue); //code works but gives error when you exit.
switch (event)
{
case EVENT_COMMIT:
ExcelRpt_RangePrint (ExcelWorksheetHandle, CellRangeValue, 1);//works in Excel sheets only (not Excel ActiveX).
break;
case EVENT_RIGHT_CLICK:
break;
}
return 0;
}
To solve the problem above, remove the highlighted code above and place it at location shown below:
int CVICALLBACK RangePrint (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
char CellRangeValue[10]={"\0"};
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal(panelHandle, PANEL_MYCELLRANGE, CellRangeValue); //code would run and exit without errors.
ExcelRpt_RangePrint (ExcelWorksheetHandle, CellRangeValue, 1);//works in Excel sheets only (not Excel ActiveX).
break;
case EVENT_RIGHT_CLICK:
break;
}
return 0;
}
Please search your code for errors like this, correct it and let me know of the out come.
Robert Mensah (Test Engineer)