code

VFP implementation of GetZipComment and GetZipFilesList for ZIP acrchives

VFP class below allows retrieval of a ZIP file comment or a list/count of files in the ZIP archive. It uses VFP low level file functions (LLFF) to directly read the ZIP file.

Generate GUID

UDF below generates 128-bit GUID and returns it as a string in the format 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'.

MSDN:

Creating directory preserving name case

MSDN:

Counting lines in an ASCII file

There is more than one way to count lines in an ASCII file.

How to check if variable is Integer

FoxPro doesn't provide a direct way to check if variable is integer or how many digits it has after decimal point but it can be accomplished using PADL() function.

Copy PRG contents to Clipboard

In VFP 9.0 PRG contents will be copied to clipboard in RTF format as well, if there's no 'X' in the _Vfp.EditorOptions.

The code uses Editor functions from Foxtools.fll. See George Tasker's Extended Foxtools Help Download #9333 on UT for more info.

File operations with Progressbar

It's based on the late Ed Rauh's code around SHFileOperation Win API and requires his Heap allocation class. It supports wild cards and shows standard Windows progress bar.

This is sample code. Add error handling and adjust to your requirements as necessary.

* Copy file to different name
llSuccess = FileOpWithProgressbar("H:\TEMP\tord.dbf", "H:\TMP\TEST.dbf", "Copy")
* Copy with the same name
llSuccess = FileOpWithProgressbar("H:\TEMP\tord.dbf", "H:\TMP\", "Copy")
* Copy all dbf's

VFP 9.0 Report Features in Runtime

In order to deploy VFP 9.0 object-assisted report features in runtime, the REPORT*.APP files have to be distributed with your application and their location stored into _REPORT* system variables.
The error 'Variable _REPORTOUTPUT is not found' may be generated if they are not populated properly.

Windows API support class

The class below simplifies use of Windows API function by providing methods to convert data between VFP types and Windows API types/structures

Most of the code was borrowed from Heap allocation class (clsheap) by late Ed Rauh.

_REPORT* system variables
File System Variable Notes
This is sample code. Add error handling and adjust to your requirements as necessary.

DEFINE CLASS WinApiSupport AS Custom
 
	* Converts VFP number to the Long integer
	FUNCTION Num2Long(tnNum)
		LOCAL lcStringl
		lcString = SPACE(4)
Syndicate content