Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to speed-up your VFP Application?

Memory Management

How to speed-up your VFP Application?

by  agit72  Posted    (Edited  )
Here is a procedure to speed-up your VFP Application (tested on VFP6, though):
***************************************************


* Save this File to SetMemory.PRG
* Add 2 (two) lines in you main program:
* 1. Set Procedure to SetMemory.PRG additive &&(if you have more than one Procedure File)
* 2. =SetMemory()
*

LOCAL lnAvailableMem, lpMemoryStatus, lnPct

* Running on the desktop
* Agit72 : agit72@plasa.com, admin@msp-works.com

DECLARE GlobalMemoryStatus IN Win32API STRING @lpMemoryStatus
lpMemoryStatus = REPLICATE(CHR(0), 32)
GlobalMemoryStatus(@lpMemoryStatus)

lnAvailableMem = CharToBin(SUBSTR(lpMemoryStatus, 13, 4))

*** EGL: - Added the fine tuning option
lnPct = 1
IF TYPE("goApp.nSetMemoryPct") == "N"
lnPct = goApp.nSetMemoryPct
ENDIF
lnAvailableMem = (lnAvailableMem * lnPct)

SYS(3050, 1, lnAvailableMem)
SYS(3050, 2, (lnAvailableMem/2) )

RETURN lnAvailableMem


***************************
FUNCTION CharToBin (tcWord)
***************************
LOCAL lnChar, lnWord
lnWord = 0
FOR lnChar = 1 TO LEN(tcWord)
lnWord = lnWord + (ASC(SUBSTR(tcWord, lnChar, 1)) * (2 ^ (8 * (lnChar - 1))))
ENDFOR

RETURN lnWord
ENDFUNC

Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top