Page 1 of 1

Error message question

Posted: Tue Aug 25, 2009 2:17 pm
by Peter
When I am closing the dialog box I am receiving an error message box
"Error processing this command: Activate (6)"
The number in brackets shows how many times the error condition occured.
The number in the bracket will keep increasing each time I close the
dialog bog and restast it
At start of the dialog box I properly initialize DPlot and at closing the dialog box I duly clean up DPlot:

Code: Select all

case WM_INITDIALOG:       
       .....
       if (DPlotWasActive) {
               dPlot_Start(1,&DPlotWasActive);
               if (dPlot_MinVersion(2, 1, 4, 0) == 0) {
                     MessageBox((HWND)NULL,"This program requires DPlot or DPlot Jr 2.1.4.0 or later.", "C DPLOTLIB Warning",0);
                      EndDialog(hDlg,0);
                      return TRUE;
               }
               // Use MessageBox for error messages in DPLOTLIB
                dPlot_SetErrorMethod(2);
        }
        return TRUE;

case WM_DESTROY:       
        if (DocNum) dPlot_Command(DocNum, "[FileClose()]");
        if (!DPlotWasActive) dPlot_Stop();
        if (hbmp) DeleteObject(hbmp);
        ... 
       return TRUE;
So what is this error might indicate?

Peter

Posted: Tue Aug 25, 2009 3:57 pm
by Peter
I don't know why it happened,
but when I moved the DPlot_Start() etc and DPlot_End() etc,
calls to the WinMain() I have no more errors. (So in start and stop DPlot only once not each time the dialog opened.
Peter

Posted: Tue Aug 25, 2009 5:49 pm
by DPlotAdmin
"Error processing this command: Activate (6)"
The number in brackets shows how many times the error condition occured.
Mostly coincidental. The 6 is the document index, which means there are 5 other documents open (or, at least, there were when this document was created). It's easy to lose track when you're hiding DPlot. I most likely need to do something different to make this more foolproof.

I'm a little confused by this:

Code: Select all

case WM_INITDIALOG:        
       ..... 
       if (DPlotWasActive) { 
               dPlot_Start(1,&DPlotWasActive); 
Assuming you're preserving the state of DPlotWasActive from the last time this dialog procedure was called, it looks to me like this test is doing the exact opposite of what you want. It says "If DPlot was already running, start it again. And if it WASN'T running, don't do anything."

In any case if it wasn't active then your WM_DESTROY handler is closing it, so the state of DPlotWasActive won't be consistent with whether DPlot is running or not.

That's assuming you aren't doing something somewhere else with calls to DPlot_Start/DPlot_Stop. Until you get this worked out to your satisfaction, it might be a good idea to NOT hide DPlot at startup. Then you can see whether documents and/or DPlot get closed when you intended.

Posted: Wed Aug 26, 2009 7:08 am
by Peter
Sorry my mistake. I meant:

Code: Select all

if (!DPlotWasActive) {
               dPlot_Start(1,&DPlotWasActive); 
               ..
}
and DPlotWasActive is declared as static in dialog box.
But as I mentioned before, I am just doing dPlot_Start once at the beginning of the program and dPlot_Stop when I quit. That works.

As far as the "warping" problem of the surface plot I mentioned before:
two things contributed to it (1) the fact that in the DPlot structure
the

Code: Select all

                DPlot.MaxCurves  = NumHorizontalNodes-1;
                DPlot.MaxPoints  = NumVerticalNodesl-1;

Should be set, and (2) My experimental data was collected as columns-by-rows, the opposite what DPlot assumes.

I am happy now :P

Peter