View previous topic :: View next topic |
Author |
Message |
DPlotAdmin Site Admin
Joined: 24 Jun 2003 Posts: 2310 Location: Vicksburg, Mississippi
|
Posted: Fri Jan 12, 2007 12:03 am Post subject: Need help from a VB.NET guru |
|
|
The Project2 VB.NET DPLOTLIB demo (retrieve a bitmap of a graph from DPlot, paint the bitmap on a picture control, translate mouse movement to x,y coordinates (and z in the case of 2D views of 3D data) locks up after a short while and I've banged my head on the wall with this for too long. It is a bit frustrating because the VB6, C, and C# demo programs that all do essentially the same thing work like a charm.
If you click any of the plot buttons and move the mouse around on the picture for more than a few seconds it will lock up (no error message, just unresponsive). So it must be something in the MouseMove handler... but no, that's not it because you can keep the mouse away from the picture and lock the program up by clicking plot buttons somewhere between 3 and 6 times.
If you replace the call to DPlot_GetBitmapEx with DPlot_GetBitmap, all works fine: you can click any of the 3 plot buttons all day long (though you no longer get scaling information from DPlot, so mapping mouse position to data space is out.) So it must be something wrong with the way the DPLOT_PLOTMETRICSEX structure is returned by DPlot_GetBitmapEx... but I'll be darned if I can see what.
The prototype for DPlot_GetBitmapEx is:
Declare Function DPlot_GetBitmapEx Lib "dplotlib" (ByVal DocNum As Integer, ByVal cx As Integer, ByVal cy As Integer, ByRef DPM As DPLOT_PLOTMETRICSEX) As IntPtr
All functions in DPLOTLIB.DLL are __stdcall, which is the default calling convention in VB.NET. But just in case I tried:
<DllImportAttribute("dplotlib.dll", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall, BestFitMapping:=False)> _
Function DPlot_GetBitmapEx(ByVal DocNum As Integer,...) As IntPtr
End Function
No change.
To ensure that VB.NET wasn't somehow rearranging the members of DPM I tried adding <StructLayout(LayoutKind.Sequential)> to the top of the Structure DPLOT_PLOTMETRICSEX definition... again, no change.
If it was a stack problem I could understand why calling the function several times would cause a problem. But I'm flummoxed why the MouseMove event would cause a problem - it's like the DPM structure is somehow volatile, which makes no sense to me (Dim DPM As DPLOT_PLOTMETRICSEX is outside any procedure).
Any ideas?
P.S. I'm using Microsoft Visual Basic 2005 Express Edition. _________________ Visualize Your Data
support@dplot.com |
|
Back to top |
|
|
DPlotAdmin Site Admin
Joined: 24 Jun 2003 Posts: 2310 Location: Vicksburg, Mississippi
|
Posted: Fri Jan 12, 2007 9:10 am Post subject: |
|
|
Whoops. Nevermind
It seems I've just been lucky with the other environments in which this does work. There was a problem in DPLOTLIB.DLL which is now fixed and will be released with the next update (coming this weekend). _________________ Visualize Your Data
support@dplot.com |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|