Error message question

Have a suggestion for improving DPlot or a question about existing features? Let us know

Moderator: DPlotAdmin

Post Reply
Peter
Posts: 10
Joined: Mon Aug 24, 2009 9:10 am

Error message question

Post 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
Peter
Posts: 10
Joined: Mon Aug 24, 2009 9:10 am

Post 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
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post 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.
Visualize Your Data
support@dplot.com
Peter
Posts: 10
Joined: Mon Aug 24, 2009 9:10 am

Post 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
Post Reply