Board index » delphi » "Canvas does not allow drawing"?

"Canvas does not allow drawing"?

Hello, I use delphi5 to write a small program. I put many components on the
main form and the interface is very beautiful. I didn't write any code yet
and ran my program under win98. But when I ran more than a specified number
of instance such as 3, the main form couldn't be shown and a dialog box
popuped with the message "canvas does not allow drawing". if this program
was run under win2000, I can open many instance of it without the error
message. I wonder if there is something wrong in drawing canvas under win98
using delphi5? I am eager to know the solution to this problem. Thanks.
 

Re:"Canvas does not allow drawing"?


Usually this error is occured when free memory is not enough.

--
With best regards, Mike Shkolnik
E-Mail: mshkol...@scalabium.com
        mshkol...@yahoo.com
WEB: http://www.scalabium.com

jwzhou <jwz...@i314.net> D??? ???Y??:3c85bf9e$1_2@dnews...

Quote
> Hello, I use delphi5 to write a small program. I put many components on
the
> main form and the interface is very beautiful. I didn't write any code yet
> and ran my program under win98. But when I ran more than a specified
number
> of instance such as 3, the main form couldn't be shown and a dialog box
> popuped with the message "canvas does not allow drawing". if this program
> was run under win2000, I can open many instance of it without the error
> message. I wonder if there is something wrong in drawing canvas under
win98
> using delphi5? I am eager to know the solution to this problem. Thanks.

Re:"Canvas does not allow drawing"?


No, not a memory problem, but a resource problem
Under windows 3.x/4.x (95/98/ME) you cannot create too many GUI objects
(GDI & USER resources).
There is quite low limit, same limit with 8 Mb RAM than with 512 Mb RAM.
It is displayed in the About window of Windows' Explorer :
Resources : 85 % Free.
When it reach 0 you can reboot the PC.
When it is below 5 you have problems, like "canvas does not allow
drawing" in Delphi/Builder applications.

I hope that I did not say to many mistakes ;)

Quote
Mike Shkolnik wrote:
> Usually this error is occured when free memory is not enough.
> jwzhou <jwz...@i314.net> D??? ???Y??:3c85bf9e$1_2@dnews...

>>Hello, I use delphi5 to write a small program. I put many components on

> the

>>main form and the interface is very beautiful. I didn't write any code yet
>>and ran my program under win98. But when I ran more than a specified

> number

>>of instance such as 3, the main form couldn't be shown and a dialog box
>>popuped with the message "canvas does not allow drawing". if this program
>>was run under win2000, I can open many instance of it without the error
>>message. I wonder if there is something wrong in drawing canvas under

> win98

>>using delphi5? I am eager to know the solution to this problem. Thanks.

Re:"Canvas does not allow drawing"?


Quote
> Usually this error is occured when free >memory is not enough.

I have 256M memory and I close all other programs before I run my program.

Re:"Canvas does not allow drawing"?


--

Quote
In article <3c86c6f3_2@dnews>, "jwzhou" <jwz...@i314.net> wrote:
>> Usually this error is occured when free >memory is not enough.
> I have 256M memory and I close all other programs before I run my program.

How about resources? (look in control panel).
you said
Quote
> I put many components on the main form

Many components = many resources.
resources <> memory.

Re:"Canvas does not allow drawing"?


Yes, I think the resources are not enough. I have win98 and win2000
installed in my computer. But why will the program can be open many times
under win2000 and fails under win98? Dose it have anything to do with the
operation system or with delphi ?

Re:"Canvas does not allow drawing"?


Quote
In article <3c873e3e$1_1@dnews>, "jwzhou" <jwz...@i314.net> wrote:
> Yes, I think the resources are not enough. I have win98 and win2000
> installed in my computer. But why will the program can be open many times
> under win2000 and fails under win98? Dose it have anything to do with the
> operation system or with delphi ?

With the operating system.
W95 and 98 are notoriusly bad at running out of resources.

So afaics you have the choices.
1. Allow only 1 instance of the program to run.
2. Reduce the number of components you use.
3. Tell users that they must install W2K.
- as appropriate.

-Iain.

Other Threads