[python-win32] win32gui, win32ui -- how to release references?

Niki Spahiev niki at vintech.bg
Tue Mar 22 09:31:22 CET 2005


Tim Roberts wrote:
> On Sun, 20 Mar 2005 23:56:33 -0500, Marcus Goldfish 
> <magoldfish at gmail.com> wrote:
> 
>> As an addendum to my previous post: I was able to successfully do
>> screen capturing using win32gui + win32ui, [though I am still looking
>> for a solution that works without win32ui].
>>
> 
> Why?  win32ui is just a wrapper around user32.dll.  That's the way you 
> get UI stuff done on Windows.

Not true. win32ui is wrapper around MFCxx.DLL

> 
>> In the C/C++ code snippets I've seen, the cleanup step usually
>> involves ReleaseDC(hwnd, hDC), DeleteDC(myDC), and
>> DeleteObject(myBitmap).
>>
> 
> Right, and every programmer forgets those.  That's why there are so many 
> wrapper classes to handle them automatically.
> 
>> Are these steps automatically handled in
>> Python by win32gui and win32ui?  If not, can someone post a snippet of
>> cleanup code that works for this example?
>>
> 
> Yes, it is automatic.  When the objects are destroyed, the resources 
> will be released.

IMHO only win32ui objects are automatic.

Niki Spahiev




-- 
С уважение,

Николай Спахиев
Винтех ООД



More information about the Python-win32 mailing list