|
|
 | | From: | Jan Hoelterling | | Subject: | Windows Error in dBase with particular control | | Date: | Tue, 21 Dec 2004 08:16:21 -0600 |
|
|
 | Hi Folks,
I hope someone can give me an idea what to do about this (if anything).
The control in question is "ASP Painter" (www.asppainter.com). ASPPainter can be used to create new and edit existing images. It has a large number of painting functions to draw lines, bars, rectangles, polygons, ellipses, arcs, pie charts, to draw text and fill images. You can load and save images from/to files, databases and binary data streams.
The implementation in dBase is extremely easy: // instantiate new OLE client pic = new oleautoclient("asppainter.pictures.1")
// create a blank canvas pic.create(640,480)
//Type 0 sets PNG format (default), type 1- Jpeg, type 3 - GIF, type 4 -TIFF, type 5 - BMP pic.setformat(5)
// start drawing pic.setcolor(255,255,255,255) for i=80 to 560 step 80 pic.DrawLine(i,0,i,480) next i
// Save it pic.SaveToFile("E:\drawing1.bmp")
// Clean up pic.Destroy() release pic pic = null
Now, here is the problem: After running this code, after some random period of time, a WINDOWS error message will appear that dbase has encountered an internal problem and needs to close. Not a dBase unstable message, but the Windows error. I've (inconclusively) traced the problem to the line "pic.destroy". If I leave out that line, I don't seem to be getting the error. But, of course, I am eating up about 1 MB with every run of the program (according to the task manager, which may not be a meaningful value under XP?), which only seems to get released once I close down dBase.
Can anybody help me with the following questions: - Do I need to worry about the memory? Should I conduct a test where I run this program in a large loop (i.e, 1000 times) and see if I run out of memory? - Any ideas what might be causing a Windows error message to pop up, or how to even trace what the heck is going on?
Last, but not least, any other ideas for controls that allow to draw and then save this as a file?
I am really stumped - any thoughts are appreciated.
Thanks,
Jan
|
|
 | | From: | Marty Kay | | Subject: | Re: Windows Error in dBase with particular control | | Date: | Tue, 21 Dec 2004 13:43:48 -0500 |
|
|
 | Jan,
> // Clean up > pic.Destroy() > release pic > pic = null > > Now, here is the problem: After running this code, after some random period > of time, a WINDOWS error message will appear that dbase has encountered an > internal problem and needs to close. Not a dBase unstable message, but the > Windows error. I've (inconclusively) traced the problem to the line > "pic.destroy". If I leave out that line, I don't seem to be getting the > error. But, of course, I am eating up about 1 MB with every run of the > program (according to the task manager, which may not be a meaningful value > under XP?), which only seems to get released once I close down dBase.
What, if anything, does the control's documentation say about the Destroy() method?
See if changing the code to as follows prevents the error: pic.Destroy() // release pic pic = null
- Marty Kay (dBI) -
|
|
 | | From: | Jan Hoelterling | | Subject: | Re: Windows Error in dBase with particular control | | Date: | Tue, 21 Dec 2004 13:24:31 -0600 |
|
|
 | Thanks for the reply, Marty.
I did some more research on this and found out that I was calling the "wrong" method. Well, not entirely wrong, but not the right one, either.
From their help: Destroy Destroy image and free allocated memory
DestroyALL Destroy images, objects and free allocated memory
So, I am now calling the DestroyAll method, and the error is even more sporadic.
> See if changing the code to as follows prevents the error: > pic.Destroy() > // release pic > pic = null
I will try that, thank you.
Jan
|
|
 | | From: | Ivar B. Jessen | | Subject: | Re: Windows Error in dBase with particular control | | Date: | Tue, 21 Dec 2004 21:10:44 +0100 |
|
|
 | Tue, 21 Dec 2004 08:16:21 -0600 chr(10) dbase.third-party-tools chr(10)Windows Error in dBase with particular control chr(10) "Jan Hoelterling" chr(10)
>// Save it >pic.SaveToFile("E:\drawing1.bmp") > >// Clean up >pic.Destroy() >release pic >pic = null > >Now, here is the problem: After running this code, after some random period >of time, a WINDOWS error message will appear that dbase has encountered an >internal problem and needs to close. Not a dBase unstable message, but the >Windows error. I've (inconclusively) traced the problem to the line >"pic.destroy". If I leave out that line, I don't seem to be getting the >error. But, of course, I am eating up about 1 MB with every run of the >program (according to the task manager, which may not be a meaningful value >under XP?), which only seems to get released once I close down dBase.
Does it help if you clean up in this way?
// Clean up pic.Destroy() pic.DestroyAll() release object pic release pic
Ivar B. Jessen
|
|
 | | From: | Jan Hoelterling | | Subject: | Re: Windows Error in dBase with particular control | | Date: | Tue, 21 Dec 2004 15:28:17 -0600 |
|
|
 | "Ivar B. Jessen" wrote in message news:4h0hs0pif62nio7dtd4iacpcbpt24ps841@4ax.com... > Does it help if you clean up in this way? > > // Clean up > pic.Destroy() > pic.DestroyAll() > release object pic > release pic
Hi Ivar,
interesting idea and not something I had tried. I will try it out and post success/failture back here.
This is just a cool little control that I really would like to get working!
Jan
|
|
 | | From: | Ivar B. Jessen | | Subject: | Re: Windows Error in dBase with particular control | | Date: | Wed, 22 Dec 2004 07:55:46 +0100 |
|
|
 | Tue, 21 Dec 2004 15:28:17 -0600 chr(10) dbase.third-party-tools chr(10)Re: Windows Error in dBase with particular control chr(10) "Jan Hoelterling" chr(10)
>> // Clean up >> pic.Destroy() >> pic.DestroyAll() >> release object pic >> release pic > >Hi Ivar, > >interesting idea and not something I had tried. I will try it out and post >success/failture back here.
The functions pic.destroy() and destroyAll() does not appear to work, in other words you are creating a monster that you can not kill :-)
From the command line type,
pic = new oleautoclient( "ASPPainter.Pictures.1" ) ? pic // object
release object pic ? pic // object
pic.destroy() ? pic // object
pic.destroyAll() ? pic // object
release object pic ? pic // object, the object survives all attempts to kill it.
Typing 'pic = null' or 'release pic' just removes the reference to the object, but does not remove the object from memory.
>This is just a cool little control that I really would like to get working!
Yes, for simple vbs samples it is very easy to adapt the code to run from dBase, I tried the example 'color.vbs'. The more advanced examples look rather complicated.
With your example I got a bmp file which resulted in
Error: Unexpected type: D:\vdbproj\Grafik\ASPpainter\drawing1.bmp
when double clicking the file name in the Navigator or pressing F2. Pressing shift+F2 opened the file in MSPaint. The file extensions jpg and png worked without said error.
Ivar B. Jessen
|
|
 | | From: | David Stone | | Subject: | Re: Windows Error in dBase with particular control | | Date: | Wed, 22 Dec 2004 10:49:28 -0800 |
|
|
 | "Ivar B. Jessen" wrote:
> The more advanced examples look rather complicated.
No kidding...looks very good for simple graphics needs, but I would not use this tool as a cheap stand-in for a graphing OCX. Also unfortunate that it doesn't save to metafile format...only bitmap flavors, AFAICS.
David
|
|
 | | From: | Jan Hoelterling | | Subject: | Re: Windows Error in dBase with particular control | | Date: | Wed, 22 Dec 2004 13:27:57 -0600 |
|
|
 | Hi David,
I am open to other suggestions... This is the best I could find that seemed to work with dBase.
Please let me know what other options I should consider.
Thanks,
Jan
|
|
 | | From: | David Stone | | Subject: | Re: Windows Error in dBase with particular control | | Date: | Wed, 22 Dec 2004 15:05:19 -0800 |
|
|
 | Jan Hoelterling wrote:
> I am open to other suggestions... This is the best I could find that seemed > to work with dBase. > > Please let me know what other options I should consider.
Jan, are you trying to use it to create graphs?! I use the TeeChart ocx for that, and it saves to various image formats including metafile (also saves to clipboard). For an app I am writing that generates product labels I use the ViewPro ocx...essentially Vic's Printer/Preview class on steroids, and saves to various formats including metafile. The "screen" on which the graphics/text appear is actually a print preview screen, but the user doesn't particularly need to know that...;-). It has some very nice zoom capabilities.
Actually, TeeChart could be used for creating custom graphics as it allows access to API shapes (via code), but that'd be overkill, I think.
If you're just doing simple stuff (lines, basic shapes, etc), ASPPainter looks fine...and at $75 it's much cheaper.
David
|
|
 | | From: | Jan Hoelterling | | Subject: | Re: Windows Error in dBase with particular control | | Date: | Thu, 23 Dec 2004 06:29:58 -0600 |
|
|
 | Hi David,
well, what I am doing is better described as diagrams, not graphs. I looked at TeeChart, it does not seem to do what I need to do, because I need to just draw rectangles, circles, lines, gradients, put text labels, etc. Not a predefined chart type as such, but still a graphical representation of numeric data.
I will take a look at that ViewPro - it looks very powerful, but may be overkill for what I need.
Thanks for the info!
Jan
|
|
 | | From: | David Stone | | Subject: | Re: Windows Error in dBase with particular control | | Date: | Thu, 23 Dec 2004 10:33:58 -0800 |
|
|
 | Jan Hoelterling wrote:
> because I need to just draw rectangles, circles, lines, gradients, put text > labels, etc. Not a predefined chart type as such, but still a graphical > representation of > numeric data.
Jan, it sounds like ASPPainter might be about right, then. You can develop your own "wrappers" for its methods to easily generate the image components that you need.
David
|
|
 | | From: | Ronnie MacGregor | | Subject: | Re: Windows Error in dBase with particular control | | Date: | Tue, 21 Dec 2004 18:40:30 -0000 |
|
|
 | In article , jhoelterling@compuserve.com says...
Hi Jan
> - Any ideas what might be causing a Windows error message to pop up, or how > to even trace what the heck is going on?
To find out if the problem lies with dBASE or the control, have you tried the same routine from another language ?
> Last, but not least, any other ideas for controls that allow to draw and > then save this as a file?
This can be done with some limitations using a paintbox control. If interested let's take this to e-mail.
-- Ronnie MacGregor Scotland
|
|
 | | From: | Jan Hoelterling | | Subject: | Re: Windows Error in dBase with particular control | | Date: | Tue, 21 Dec 2004 13:21:48 -0600 |
|
|
 | Hi Ronnie,
thanks for your reply.
"Ronnie MacGregor" wrote in message news:MPG.1c327e3af0bedf64989693@news.dbase.com... > To find out if the problem lies with dBASE or the control, have you > tried the same routine from another language ? Great idea, I will do that!
> > Last, but not least, any other ideas for controls that allow to draw and > > then save this as a file? > > This can be done with some limitations using a paintbox control.
I am interested, but I have a feeling what I need to do may be a little too involved .But since I have no clue about what the paintbox can do, I may be speaking out of turn. Can you please send me an email to jhoelterling NOSPAM at compuserve.com with your address?
Thank you,
Jan
|
|
|