Difference between FUNCTION and PROCEDURE statements

Syntactically there is no difference between FUNCTION and PROCEDURE statements in VFP. In other languages, that have both statements, a function can return a value and a procedure cannot. In VFP the difference comes in the way a procedure/function is called. By default VFP passes parameters by value in call to the functions, by reference to the procedures ( DO ...) and only former allows for a return value.

Determine Printer Margins Programmatically

The GetDeviceCaps function can be used to retrieve printer-specific information as demonstrated below.

Determine Invalid Characters in File Name and Path

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

Detect Multiple Monitors

The GetSystemMetrics WIN API can be used to get the number of monitors. Some other constants related to multi-monitor PC configurations are also included.

CRC16 - Polynom 0x8005

Relevant links: http://www.summitinstruments.com/knowledge_center/pdf/TN410.pdf http://www.lammertbies.nl/comm/info/crc-calculation.html?crc=1234567898765421&method=ascii

Copy, Move, Rename File Preserving Destination Name Case

The CopyFile() and MoveFile() WIN API functions preserve the case of the name for the destination file. Alternatively, WSH can be used. The source and destination file names should include the directory name in both cases.
Note 1 A Copy operation will not change file name case when destination file already exists (overwritten).
Note 2 The WinApiErrMsg is used to retrieve Windows API error message in case of error.

Copy Command Window Selected Text to Clipboard Programmatically

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