GDI/User resources going out in Win98 WinMe

Hi all,

I'm having the following problem when running my app in Win98 or WinMe (not
in Win2000, NT, XP):

I have a frame, with -MANY- frames inside of it. When I try to open the
frame (just to open it in Delphi in WinMe), it crashes with "Canvas does not
allow drawing" or smth like that. Unnecesary to say that the same happens to
the Application when I try to run it (either in 98 or Me).

Im trying to solve this by dynamically creating the frames (so, if you plan
to use them extensively, BE CAREFUL). This approach has worked so far, but I
want to know if there is some way, using some API function, or smth like
that (?sizeOf?), so as to find if Ill be able to create the Frame, showing
a nice message that reads: "You must free some resources before opening this
form, etc, etc", and avoiding the consecuent crash (I've tested it, and if
you open enough "Explorers", you can cause a already working form to
crash... (?not to be done at home if you dont want to restart your
machine!!<g>)). Im already using try/except, but I think its better to
prevent this, than relying in Win98...

Does anyone know how to do this? What should I measure before creating the
frame? Or perhaps another way to solve this -{*word*193}- problem?