PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Rudolf Fürstauer on November 02, 2007, 03:14:56 PM

Title: repaint problem
Post by: Rudolf Fürstauer on November 02, 2007, 03:14:56 PM
Hi Paul,

I have a big problems with the repaint of my applications.
There ist no problem if i start a applications for use of a short time,
but i get problems if the applications runs for hours or days or weeks.

I write many applications, which runs on productionmaschines and this
applications runs for days or weeks.

I get following alterations on my dialogs:

* missing icons of toolbar
* missing content of Listview or MyLittlegrid
* missing buttons
* missing titlebar or titlebar is black (original blue gad.)
* ......

I try do find a solution for this behavior and use
at the moment folling code for repaint: (without success)  :(

Function FRMMESSDATEN_CUSTOM (hWndForm As Dword, wMsg As Long, wParam As Dword, lParam As Long) As Long
 
Select Case wMsg

'============================================
'repaint
'============================================                   
        Case %WM_PAINT, %WM_NCPAINT
            RedrawWindow hWndForm, ByVal %Null, ByVal %Null, %RDW_FRAME Or %RDW_NOERASE Or %RDW_INVALIDATE Or %RDW_ALLCHILDREN Or %RDW_INTERNALPAINT
           

Please give me a clue for this problem, because i get troubles with my customers.
The must restart the application and it works well, for a while.


Thanks for your help.


Rudolf
Title: Re: repaint problem
Post by: TechSupport on November 02, 2007, 06:00:18 PM
It sounds to me like you may being experiencing a slow GDI resource leak that over time amounts to such a size that it affects your program. I hope that the leak is not within the FireFly generated code itself.

Do you create or load fonts, pens, brushes, icons, bitmaps anywhere in your program? If yes, then you need to make sure that the objects are correctly deleted (DeleteObject api) after you unselect the object from the DC.

Try running your program and look at the GDI object count in the Task Manager as you perform certain functions. At any point does the GDI count increase sharply? If it does, then take note of the action you performed and then look at your code to see if you are creating GDI objects but not deleting them.

I hope this is a good starting point for you - it seems like it may be a possible cause.

Title: Re: repaint problem
Post by: TechSupport on November 02, 2007, 06:02:18 PM
You may want to test any 3rd party controls as well for GDI leaks. I haven't tried MyLittleGrid (not to pick on that control) in a long time so I am not sure if it is 100% free of resource leaks.

Are you using any other 3rd party controls?

Title: Re: repaint problem
Post by: Rudolf Fürstauer on November 03, 2007, 03:11:19 AM
Hi Paul,

thank's for your response.

I do not use GDI-object's and i get this behavior either only with MS-standardcontrols.
In my opinion, but i am not sure, this problem results from FF.

Before i start with PB an FF, i do write my applications in VB and there never was any behavior like this.
I will send a projekt an your e-mail address.

Thanks


Rudolf Fürstauer
Title: Re: repaint problem
Post by: TechSupport on November 03, 2007, 05:02:20 PM
Hi Rudolf,

Thanks a million for sending me the source code. I will search through it to see if I recreate the problem and spot the source of the problem. If it is a FireFly problem then you can be assurred that I will fix it as soon as possible and send you an updated program.

Title: Re: repaint problem
Post by: Rudolf Fürstauer on November 08, 2007, 02:31:06 PM
Hi Paul,

thank you thousand times!!    ;D  ;D

With your help, i can find the problem in my applications.
The reason it is accurate as you wrote:
Quote"It sounds to me like you may being experiencing a slow GDI resource leak ...."
I use:
    hIcon = LoadImage(hInstMain,"IconIo_16", %IMAGE_ICON,16,16, %LR_DEFAULTCOLOR)
    FF_StatusBar_SetIcon (HWND_FRMMESSDATEN_STATUSBAR, 0, hIcon) 

       
but i don't destroy the object:       
    DestroyIcon hIcon
And after a couple of days, i get the strange behavior of my programm.

At the MSDN Library i can see:
When you are finished using the bitmap, cursor, or icon,
you can release its associated memory by calling one of
the functions in the following table.

Resource Release function
Bitmap - DeleteObject
Cursor - DestroyCursor
Icon   - DestroyIcon


I watch at the PB-Forum and the most sample's don't destroy the object,
but it's a importent thing.

Best regards,
Fürstauer Rudolf
Title: Re: repaint problem
Post by: TechSupport on November 08, 2007, 04:06:57 PM
I am VERY happy that you found the source of the problem. In the past, I encountered the weird drawing problems and unstableness of an application - most of the time the root of the problem was a slow GDI resource leak leading to low system resources.

Happy that I could point you in the right direction.  :)

Title: Re: repaint problem
Post by: Roger Garstang on November 08, 2007, 07:06:45 PM
Some controls like Listviews can destroy icons/icon lists on their own depending on their style.  I also use the LR_SHARED style/flag of LoadImage and since I usually never really finish using the icons in my apps I just let it get destroyed when the application exits or when the system sees it is no longer in use.  Without that style you must destroy it yourself and every call with the same resource creates another instance of it.