Page 1 of 1

DPlot.exe keeps running...

Posted: Fri Aug 28, 2009 9:54 am
by Peter
Hi,

In my application I keep replotting a 3D surface in dialog box as I recalculate it.
I noticed: when I quit my program the DPlot.exe stays on the task manager's process list. (It pops up in there when I start my program up.)

But I noticed that when I start/stop the program several times the, the
program starts acting up on the plotting: becomes slow and eventually it stops working.

Sometimes the program will plot OK if I kill the DPlot.exe in the process list after I quit my program.

Another interseting thing: when the progroram for some reason does not plot on my dialog box and I kill the DPlot.exe, the DPlot.exe APPLICATION will pop up an the plot will be displayed there (not in my dialog box.)

What is going on?
Peter

PS.:
The way I initate the plot in my program is in my main program loop after the calculations are finished I am sending a message to the plot display dialog box

Code: Select all

SendMessage( GetDlgItem(Show3DhDlg, IDC_SHOW3DBUTTON), BM_CLICK, 0, 0);    
(simulating a button click event). In that button press routine I set up the pot parameters and execute

Code: Select all

				DocNum = dPlot_Plot8(&DPlot, extents, Rec3d, szExec);
                if (DocNum) {
                    SetBitmapToFrame();
                }

Posted: Fri Aug 28, 2009 12:54 pm
by DPlotAdmin
DPlot_Stop will not shut down dplot.exe if there are any open documents. (There's really no choice about doing it this way because some other program might also be using dplot.exe and it wouldn't be appropriate to shut it down.) So - always send a FileClose command to close whatever documents your application has created.

Can't say for certain, but I'd guess if you're plotting large data sets and NOT closing those plots, things start to get sluggish because DPlot is chewing up so much memory. Or you might also be using up memory if your application is not deleting the bitmaps you're getting from DPlot when they are no longer needed.

Posted: Sat Aug 29, 2009 10:18 am
by Peter
Actulally I close the file, just like in CTEST2.c I do:

Code: Select all

               ....
                if (hbmp) {
                    DeleteObject(hbmp);
                    hbmp = 0;
                }
                if (DocNum) dPlot_Command(DocNum, "[FileClose()]");
				DocNum = dPlot_Plot8(&DPlot, extents, Rec3d, szExec);
                if (DocNum) {
                    SetBitmapToFrame();
                }
                ...
               return TRUE;

The plots are sent to my modless dialog box in a loop forever, then after a while the plots stop showing up. Then if I open DPlot.exe the plot will show up there fine.


Another (REALLY annoying) thing: If the plot is directed to DPlot.exe program the plot the program completely takes away the focus from any other application running. For instance, if I work on a word document and at the same time another program of mine makes periodic plots to the Dplot program, each time the plot is executed the focuse goes away from the Word and make it impossible to work on anything else when Dplot is being called.

Any solutions?
Peter

Posted: Sat Aug 29, 2009 10:45 am
by DPlotAdmin
You're welcome to send me your program and I'll take a look. It sounds to me like you're sending too much data too fast for DPlot and the DLL to keep up with, and the DLL isn't correctly griping about it.

"Another (REALLY annoying) thing:"

If you're talking about dplot.exe being visible when this happens, that behavior is by design. If your program didn't shut down dplot.exe before this happened then it (dplot.exe) might have crashed. Either way, your next call to DPlot_Plot will cause dplot.exe to start up visible.

Posted: Sun Aug 30, 2009 10:26 am
by Peter
David,
I'll send you the dialog callback function on Monday.

About sending to much data: no way:
the surface is usually a 20x20 array, maximum size is 60x60.

I am calling Dplot_Plot8() about once per second and I monitor
the time of execution of Dplot_Plot8() and it is between 70 -200 ms, depending on the plot size.

In addition, I avoid making another Dplot_Plot8() call while one is being executed by WaitForSingleObject() in the procedure that initiates the plot.
(The WaitForSingleObject() is unblocked only when the Plot_Plot8() is done.

I still think that Dplot.exe (the stand alone application) is fully grabbing the focus and making it nearly impossible to work on any other running application - is a mistake: making an applocation in focus, in my view, should be the users choice...I should add though that this represents a problem only when a program makes periodic calls to Dplot.

Peter