clipper exe and time cpu

Post Reply
Piscicelli Zingoni
Posts: 76
Joined: Wed Oct 12, 2005 5:52 pm
Location: Milan,Italy

clipper exe and time cpu

Post by Piscicelli Zingoni »

Hi,
In my old clipper application on XP when running an exe program i see the pc works very slow in special when run a second application.
Is there some prg/obj to use to minimize the running of the exe clipper application while it is in backgrownd (with no focus) ?

Tks
P/Z
User avatar
tnhoe
Posts: 83
Joined: Tue Nov 08, 2005 11:09 am
Location: Malaysia
Contact:

Post by tnhoe »

- recompile it with Harbour/xHarbour
- set the exe desktop icon properties to 'minimize'
- if u call it from Fivewin => winexec('clip.exe', 6)
Regards

Hoe, email: easywin3@yahoo.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
Piscicelli Zingoni
Posts: 76
Joined: Wed Oct 12, 2005 5:52 pm
Location: Milan,Italy

Post by Piscicelli Zingoni »

Thanks to all
User avatar
Badara Thiam
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France
Contact:

Post by Badara Thiam »

Antonio Linares wrote:Piscicelli,

Please review this:
http://www.ghservices.com/gregh/clipper/trix0014.htm
Antonio,

I have today 3 actives versions of my softs :

1 : Compiled with Clipper 5.3b, Linked with Blinker 7.0

2 : Compiled with Clipper 5.3b with Fern Graphic Library instead Light Lib,
Linked with Blinker 7.0

3 : Compiled with Clipper 5.3b with Fivewin 2.5, Linked with Blinker 7.0


My tests demonstrate this :

OL_YIELD() and OL_AUTOYIELD( .T. ) do absolutely nothing when
i use the version 3. Under XP the CPU use is 100%.

With Blinker 7, the new BLICPUREL() function can replace OL_YIELD()
and OL_AUTOYIELD(), but don't work under Windows executables.

With SysRefresh() and/or SysWait(), no changes : always 100% CPU use.

Is there an other way to solves this ?
Badara Thiam
http://www.icim.fr
User avatar
Badara Thiam
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France
Contact:

Re: clipper exe and time cpu

Post by Badara Thiam »

Piscicelli Zingoni wrote:Hi,
In my old clipper application on XP when running an exe program i see the pc works very slow in special when run a second application.
Is there some prg/obj to use to minimize the running of the exe clipper application while it is in backgrownd (with no focus) ?

Tks
P/Z
Now i have solved a similary problem using fivewin StopUntil()
combined with class TTimer() and few others specifics
to my proper use. StopUntil() is not documented in FW 2.5.

CPU time was 100 % yesterday, 3 % now !

Regards,
Badara Thiam
http://www.icim.fr
User avatar
tnhoe
Posts: 83
Joined: Tue Nov 08, 2005 11:09 am
Location: Malaysia
Contact:

Post by tnhoe »

Could u plz post a sample prg of using stopuntil() ?

I need it too.
Regards

Hoe, email: easywin3@yahoo.com
User avatar
Badara Thiam
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France
Contact:

Post by Badara Thiam »

Here is the baby


************

* WINATTEN.PRG
* Creation le 12/02/2006
* Derniere modification le 14/02/2006 à 22:01:58
* Auteur Badara THIAM

#include "fivewin.ch"

STATIC lExit := .F.
STATIC AncFocus

******************
FUNCTION WINATTEND(nDelai, ETATPRECG, ETATPRECD)
******************
* Etat d'attente permettant de réduire le temps CPU sous Windows
* nDelai doit être indiqué en millisecondes
STATIC BCOND
STATIC oTmr
STATIC NOUVDELAI := 1
STATIC ANCMILLI

lExit := .F.
ancFocus := GetFocus()


IF oTmr = NIL .OR. NOUVDELAI != MAX(nDelai, PUBVAR(155))
NOUVDELAI := MAX(nDelai, PUBVAR(155))
IF oTmr != NIL
oTmr:End()
ENDIF
oTmr := TTIMER():New( MIN(10, NOUVDELAI), { || lExit := .T. }, WndMain() )
ENDIF

BCOND := { || WINATTEND2(@ETATPRECG, @ETATPRECD) }

IF !EVAL( BCOND )
oTmr:Activate()
ANCMILLI := GetTickCount()
DO WHILE .T.
STOPUNTIL( BCOND )
IF !lExit .AND. EVAL( BCOND )
EXIT
ELSE
IF ( GetTickCount() - ANCMILLI ) >= NOUVDELAI
EXIT
ELSE
lExit := .F.
ENDIF
ENDIF
ENDDO
oTmr:DeActivate()
ENDIF
RETURN NIL

*******************
FUNCTION WINATTEND2(ETATPRECG, ETATPRECD)
*******************
RETURN ( lExit ;
.OR. GGMSTATE("LEFT") != ETATPRECG .OR. GGMSTATE("RIGHT") != ETATPRECD ;
.OR. GetFocus() <> ancFocus .OR. keyNext() <> 0 ;
.OR. PUBVAR(132) .OR. PUBVAR(139) ;
.OR. GetAsyncKey( VK_MENU ) .OR. GetAsyncKey( VK_SHIFT ) .OR. GetAsyncKey( VK_CONTROL ) ;
)
**************

Regards,
Badara Thiam
http://www.icim.fr
User avatar
tnhoe
Posts: 83
Joined: Tue Nov 08, 2005 11:09 am
Location: Malaysia
Contact:

Post by tnhoe »

What is the parameter values to send when calling Winattend() :-

=> nDelai, ETATPRECG, ETATPREC ???

Thanks.
Regards

Hoe, email: easywin3@yahoo.com
User avatar
Badara Thiam
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France
Contact:

Post by Badara Thiam »

tnhoe wrote:What is the parameter values to send when calling Winattend() :-

=> nDelai, ETATPRECG, ETATPREC ???

Thanks.
nDelai = the delay in millisecond required by your parent function.
ETATPRECG = the previous state of the left button of the mouse.
ETATPRECD = the previous state of the right button of the mouse.

PUBVAR(155) is the maximal delay can be used (1 to 1000, 500 is good).
This parameter can be changed by your user...
PUBVAR(132) is .T. when the Windows receive the focus.
PUBVAR(139) is .T. each time WndMain():bPainted is evaluated.

Regards,
Badara Thiam
http://www.icim.fr
User avatar
tnhoe
Posts: 83
Joined: Tue Nov 08, 2005 11:09 am
Location: Malaysia
Contact:

Post by tnhoe »

I do this :

:
:
ACTIVATE WINDOWS oWnd ON INIT (winattend(500,,),.F.)


after link it and give following errors : UNRESOLVED EXTERNAL

PUBVAR
STOPUNTIL
GGMSTATE
KEYNEXT

I use Clipper 5.2, Fivewin 1.95 only
Regards

Hoe, email: easywin3@yahoo.com
User avatar
Badara Thiam
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France
Contact:

Post by Badara Thiam »

I have found a reference to StopUntil() in RPREVIEW.PRG
Antonio can say you where this function is located.

The rest is composed of functions made by me. You must
create your own equivalent functions depend how you program.
To help you, look at this :

GGMSTATE("LEFT") return the current state of the left button of the mouse
GGMSTATE("RIGHT") return the current state of the right button of the mouse

PUBVAR() contain a static array where i put all my "public" variables
(so it's not public).

WINATTEND() must be used in your wait state procedure,
not in the "ON INIT" of a Window. I you have a problem with
CPU time, this is because your application start in the "ON INIT"
of the main Window, no ? Your program never stop, always
it do something, like waiting keybord and state of the mouse.
With WinAttend(), you can stop where you want to reduce
the activity of your program. Place it in all the wait states
is the first step.

If yours wait states was controled directly by a window,
a dialog, a get, or i don't know what other, you have
not this problem. But to do that, you must rewrite a very
big part of your code. This is not my way today, i want
keep the same code for my DOS exe and for my Windows exe.

KeyNext() return the same values than Clipper DOS NextKey().
I have created this function because i never can use TGET class,
an few years ago i have rewritted Clipper GET, TBROWSE,
MEMOEDIT, LABELS and few others. I control all the wait states
in Clipper, and now in Fivewin with just a call of WinAttend()
in my unique wait state procedure.

Regards,
Badara Thiam
http://www.icim.fr
Post Reply