WaitRun using 100% processor time

WaitRun using 100% processor time

Postby Euclides » Tue Nov 22, 2011 11:48 am

Hi to all,
I have some old sistems in FW and Clipper and for several resons, I did not convert them to FWH.
Instead, I wrote routines to access internet data in FWH and intended to call them with WaitRun() from the FW Clipper sistems.
The I learned the WaitRun in FW Clipper uses 100% cpu time and WaitRun in FWH does not use cpu time.
Is there a solution in FW Clipper level or I have the convert the whole systems?
Regards, Euclides
User avatar
Euclides
 
Posts: 156
Joined: Wed Mar 28, 2007 1:19 pm

Re: WaitRun using 100% processor time

Postby James Bott » Wed Dec 21, 2011 3:09 pm

Euclides,

Try this.

Regards,
James


Code: Select all  Expand view
//-----------------------------------------------------//
// WaitRun() overrides the FW native function
// The 16 bit version hogs the CPU, this doesn't.
// Author: Sylvain Robert <S.Robert@videotron.ca>
// Date: 2/11/2004

#Define SW_NORMAL 1

FUNCTION Waitrun(cExec,nMode)
  LOCAL nHinstance,nCount, lWaitrun

  DEFAULT nMode := SW_NORMAL

  IF ( nHinstance:= Winexec( cExec, nMode ) ) > 31
    nCount:=GetmoduleUsage( nHinstance )

    DO WHILE GetModuleUsage( nHinstance ) >= nCount
      Waitmessage()
      SysRefresh()
    ENDDO
  ENDIF

  RETURN nHinstance

DLL FUNCTION GetModuleUsage( nProccessid AS _INT ) AS _INT PASCAL LIB "kernel"
//-----------------------------------------------------//
 
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: WaitRun using 100% processor time

Postby Euclides » Tue Jan 10, 2012 3:31 pm

Hi james, sorry for the delay (I was out of town :D ).

I remember, some time ago Sylvain has posted something about CPU hog but I could not find it googling. Glad you have it.
Meanwhile I found a similar solution with Timer and the FindWindow function.
Of course, Sylvain´s solution is better.
Thanks and a ´late´ Seasons Greatings.
Regards, Euclides
User avatar
Euclides
 
Posts: 156
Joined: Wed Mar 28, 2007 1:19 pm


Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 8 guests