FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Progress Bar problem when used with WindowsXP.Manifest file
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Progress Bar problem when used with WindowsXP.Manifest file
Posted: Fri Jan 15, 2010 09:39 AM
Hi,

I am having a problem while using Progress control. The problem is that it never reaches 100%.

The problem exists only when Manifest file is used. Is there any solution to this problem ? Or Am I doing something wrong ?

I am herewith pasting a sample code which demonstrate the problem. I am using both Meter and Progress.
In the below given sample code the Meter reaches 100%, but the Progress control reaches only somewhere around 85%



Code (fw): Select all Collapse
#Include "FiveWin.Ch"
*----------------------*
Function Main()
*----------------------*
Local oWnd,oProgress,oMeter,nActual,oBtn

DEFINE WINDOW oWnd TITLE "Test Progress and Meter"

@ 2, 5 METER oMeter VAR nActual OF oWnd SIZE 400, 30                      
@ 5, 7 PROGRESS oProgress OF oWnd SIZE 400, 30  
@8,10 BUTTON oBtn ACTION DoProcess(oMeter,oProgress) SIZE 50,50

ACTIVATE WINDOW oWnd 
Return

*----------------------------------------
Function DoProcess(oMeter,oProgress)
*----------------------------------------
oMeter:nTotal:=111
oProgress:SetRange( 0, 111 )
for n = 1 to 111
    oMeter:Set( n )
    oProgress:SetPos( n )
    Sleep( 50 )
    SysRefresh()
next
MsgInfo( n )
Return


.RC File content
Code (fw): Select all Collapse
1 24 "WindowsXP.Manifest"


If I comment out the following line on the Function DoProcess()
Code (fw): Select all Collapse
// oProgress:SetRange( 0, 111 )


then progress bar reaches 100%.

The above code is just a sample to demonstrate the problem, but in my real application, If I comment out the
Code (fw): Select all Collapse
oProgress:SetRange( 0, nTotRec ) // nTotRec is the no. of times the loop is going to work


then the Progress bar suddenly reaches 100% even though the loop has not finished yet its execution.

This is how I have coded in my real application
Code (fw): Select all Collapse
Select MyDbf
nTotRec:=RecCount()
nActual:=1
oProgress:SetRange( 0, nTotRec )
Do While !EOF()
    oProgress:SetPos( nActual++ )
        Skip
Enddo
MsgInfo( Str(nTotRec ) + CRLF + Str(nActual) )  
// Value of nTotRec and nActual is the same, but Progressbar not reached 100% - if I use oProgress:SetRange( 0, nTotRec ) 
// Value of nTotRec and nActual is the same but Progressbar reached 100% even before the Do while loop ended - If I don't use oProgress:SetRange( 0, nTotRec )


If I replace Progress with Meter then everything is working fine.
This problem exists only when Progress is used with the .Manisfest in .RC file otherwise everything is working fine

I am using Vista Business 32 bit

Any help ?

Regards
Anser
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Progress Bar problem when used with WindowsXP.Manifest file
Posted: Fri Jan 15, 2010 11:32 AM
Hi,

After reading this topic http://forums.fivetechsupport.com/viewtopic.php?f=3&t=10194
I added, oProgress:StepIt() inside the loop
Code (fw): Select all Collapse
oProgress:StepIt()  // This will slow down the process, otherwise progress bar updates are not perfect


The above command seems to solve the progress bar update problem , but the loop which used to finish within 4 seconds using METER, is now taking 17 seconds to finish when I used StepIt() along with the PROGRESS. ie 300% increase in the execution time. I don't know whether this is a good solution or not

Regards
Anser
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Progress Bar problem when used with WindowsXP.Manifest file
Posted: Fri Jan 15, 2010 12:25 PM

I recently made many tests on this problem and my conclusion is that it's a Vista bug. I can be wrong, of course.

EMG

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Progress Bar problem when used with WindowsXP.Manifest file
Posted: Sat Jan 16, 2010 05:47 AM
Dear M.EMG

I recently made many tests on this problem and my conclusion is that it's a Vista bug. I can be wrong, of course.


The problem exists in Windows 7 too.
I tested my app in XP, Vista and Windows 7 and found that in XP it is working fine and the problem exists in Vista & Windows 7.
Hope there will be a solution to this problem.

Regards
Anser
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Progress Bar problem when used with WindowsXP.Manifest file
Posted: Sat Jan 16, 2010 11:19 AM
anserkk wrote:The problem exists in Windows 7 too.


:-)

EMG

Continue the discussion