----- Original Message ----- From: "Dimitris Botsis" <[EMAIL PROTECTED]>
Hi all, I want to use drawtext on a directx surface in order to write some text; For every call to drawtext I set font name, size,color,style etc, then I drawtext and then I call release of canvas. The problem is that that whole things has a memory leak or something because for every call it consumes some kilobytes of RAM. I have red that it has to do with font caching. Now I am using DeleteObject(--font handle here---) after every release of canvas (I have red somewhere else that it may solve the problem). It seems that the memory leak does not appear but now this DeleteObject makes my fonts display without formatting - as if I did not apply any style, color or size on them. Does anyone know how to overcome this problem ? I am using UnDelphiX. Thanks in advance. ------------------------------ Are you using plain Windows API calls? there is a general rule that we must first save old canvas data, change it's value, use the canvas, then restore old datas. var hOld:HBRUSH; begin ... //get DC hOld := SelectObject( hDC, hNewBrush ); ... //use DC SelectObject( hDC, hOld ); ... //release DC end; may be somewhere along the app, a func is using canvas data that has already been deleted, that won't happen if you always restore it's old value. canvas's data such as font and brush defaulted to windows global objects which is never freed. pardon my english, FIreHAzaR:-D West Java, Indonesia ------------------------------------ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/advanced_delphi/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/advanced_delphi/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/