RE: Win32lib memory?/statement!

new topic     » topic index » view thread      » older message » newer message

> -----Original Message-----
> From: Euman [mailto:euman at bellsouth.net]

> Just one of the millions
> 
>     hdc = getDC( Screen )
>     releaseDC( Screen )
> 
> if you want to show several images on screen why
> grab and release the ScreenDC everytime.
> 
> When I said most I should have said ALL.
> 
> I like win32lib dont get me wrong.

I think you're confusing win32lib with something designed for optimal
performance in terms of speed and use of resources.  That's exactly *not*
what win32lib is all about (not that win32lib is [intentionally] about slow
code or memory leaks :).  Win32lib, like VB (which Dave originally set out
to imitate in win32lib) is designed to be easy to use, as opposed to the raw
win32 API.  

There are lots of optimizations that could be easily done to improve the
performance of a given application (such as reusing a DC for multiple
images), however, there is no way for win32lib to know when this should be
done.  It would be possible to create lots of different routines that would
optimize this sort of thing, but you'd end up with something as (or more)
confusing to the user as the original API.

I suspect that some lower level work arounds for specific bottlenecks (like
mass loading data into a listview) probably should be implemented in
win32lib (or at least a way to load the data yourself, and provide it to
win32lib so you can still access it through normal win32lib routines).

As for things like reuse of DC's, I'd suggest writing a separate include
that would wrap the minimum API calls.  This takes more effort than the
average user of win32lib is willing to put out IMHO.  Interfacing with the
win32 API can be a real pain, especially when you start having to pass
various structures.

> > One definition I'd use is that redundant code
> > is code that does nothing useful, either because some other 
> code already did
> > it or its effect has no effect on the program.
> 
> Yeah!

I'd basically agree with that definition, although I wouldn't include the
useless code (I'd call that extraneous, or something along those lines) in
the definition.  However, what specifically is redundant?  I wouldn't
consider a routine (ie, drawLine) that gets and releases a dc to be
redundant, simply because it might be called multiple times.  As mentioned
above, I might call it non-optimized for a specific application.
 

> My opinion is if you want to use deleteItems with -1 this must mean
> that ALL of the items should go...

Right, which is how I coded it originally.  However, the sequences in
win32lib might contain the items for more than one listview.  Unfortunately,
this didn't occur to me, and whenever multiple listviews were used, problems
occurred, because items had been purged when they shouldn't have.

> Why call the same procedure as many times as you have Items 
> in the list.
> duh

If you know of a better way to free up an arbitrary list of items, knowing
that there is no reason why they should be contiguous (even when you're
deleting all items from a listview), I'd like to see it put into the
library.  It seemed a better idea to put the code into its own routine,
rather than inline it into deleteItems.

Matt Lewis

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu