Board index » delphi » Win32 API function failed on Win 9x

Win32 API function failed on Win 9x

Quote
> Our form is relying heavily on components and frames. It seems that we are
> running low on some sort of resource

win9x, is that win95 or win98 ?
Win95 has problems with a large number of resources, you should only
create your datamodule and mainform in the DPR, and create and destroy
all other forms manually when they are needed.

good luck...

  Guido.Geurts.vcf
< 1K Download
 

Re:Win32 API function failed on Win 9x


There is a limited number of "resources" available in Win9x, this limit is in now way related to
available memory, and is fairly low.
Each TWinControl subclass, TBitmap and other DC take up a resource. You can make unused bitmaps
release their DC (and free a resource) by invoking their "Dormant" method, for components, the only
way is to free/remove teh component.
Try to remove/release as many frames and TWinControl subclass components from your forms. Use TBevel
or TShape for cosmetics, make your own components, use grids/listviews to present data, avoid
TStaticText and ActiveX controls etc.

Be aware that some components can literally gobble up resources, the worst I've seen being the spin
button from RXLib (a minimum of 6 resources each...). Also, unlike what is written is the Delphi
documentation, TFrame does NOT reuse "resources", only the DFM data, and an empty frame accounts for
1 resource (like a TPanel), a frame with a single TEdit can account for 3 resources, etc.

Eric Grange

Re:Win32 API function failed on Win 9x


On a follow up of what Eric said:
    W2K contrary to popular belief DOES have resources, but the number is
very very very high.  Also note that under all windows platforms application
space has a resource limit.  If you are using lots of components on
TNoteBook's, TTabControl, or TPageControl's you can free the handle to the
hidden pages and lower your resource usage.  Then when the application needs
the handle to the page back it will re-allocate the resources.  I'm having
problems finding the code I had to do this, but their are examples all over
the web.

--
Jeremy Darling
Eon Clash
www.eonclash.com
ac_har...@hotmail.com

Quote
"Rene Pallesen" <rpalle...@hotmail.com> wrote in message

news:3aa5ac24_1@dnews...
Quote
> Has enyone encountered the "Win32 API function failed" error when opening
> forms that are fairly complex.

> We seem to get the error if we create more than two instances of the same
> form.

> Any ideas what causes it ?

> Our form is relying heavily on components and frames. It seems that we are
> running low on some sort of resource but we have been unable to determine
> what resource and what API function fails.
> We don't seem to be able to find anny bugs in the code...everything is
being
> free'd up nicely.

> Sorry about the cross posting.

> Regards,

> Rene Pallesen

Re:Win32 API function failed on Win 9x


Quote
>Rene Pallesen wrote:

> Sorry about the cross posting.

Avoid the mental strain of being sorry by just not doing it.
________
Andreas
Delphi 5.01 Pro, NT4.0 Sp5
Direct replies mailto:p...@augsburg.netsurf.de

Re:Win32 API function failed on Win 9x


Rene:

    We had and solved a similar problem on Win 9x. Here is what we did. We
identified a particular computer that seemed prone to this kind of problem.

    Next, we opened the windows resource window on the
windows/programs/accessories/System Tools menu.

    We then ran our application and simply opened and closed various
windows. We found that certain windows caused large decreases in system
resources. In fact, system resources were not repleneshed in some cases.

    As a result of this experiment, we identified the specific offending
windows. These windows were re-written to be more resource efficient. In
some cases, we also spotted resource leaks.

    In addition, you could also use software designed to spot resource
leaks. Good luck.

Neil Huhta

Other Threads