From: winson <roa...@ya...> - 2007-04-08 01:48:07
|
I finally put the library compiled into use. I added the following code in my program, as suggested by the wxWidgets example in the document. #include "plplotP.h" #include "plstream.h" #include "wxPLplotstream.h" #include "wx/dcmemory.h" #include "wx/bitmap.h" #include "wx/dc.h" class MyPanelGraph: public wxPanel { public: MyPanelGraph(wxWindow* parent); void OnPaint( wxPaintEvent &WXUNUSED(event) ); private: int MemPlotDC_width; int MemPlotDC_height; wxMemoryDC* MemPlotDC; wxPLplotstream* mPlotstream; wxBitmap* MemPlotDCBitmap; DECLARE_EVENT_TABLE() }; BEGIN_EVENT_TABLE(MyPanelGraph, wxPanel) EVT_PAINT(MyPanelGraph::OnPaint) END_EVENT_TABLE() MyPanelGraph::MyPanelGraph(wxWindow* parent) :wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE) { MemPlotDC = new wxMemoryDC(); MemPlotDCBitmap = new wxBitmap( 640, 400, -1 ); MemPlotDC->SelectObject( *MemPlotDCBitmap ); ->>mPlotstream = new wxPLplotstream((wxDC*)MemPlotDC, MemPlotDC_width, MemPlotDC_height ); } (OnPaint handler...) When I built the program, everything was fine. When I got into debug, I got an error message at the position marked by arrows, as following: "HEAP CORRUPTION DETECTED: after Normal block (#18524) at 0x01809940. CRT detected that the application wrote to the memory after end of heap buffer." At this point, the thread points to wxWindow::MSWCreate. And the call stack points to msvcr80d.dll!1021bd53(). I just started to use wxWidgets, and I am not sure if the plplot library compiled is ready for use yet. So I am not sure where the problem could be. Any insight? Thanks. Winson ____________________________________________________________________________________ Now that's room service! Choose from over 150,000 hotels in 45,000 destinations on Yahoo! Travel to find your fit. http://farechase.yahoo.com/promo-generic-14795097 |