code

Retrieving VFP runtime DLL name required by EXE or DLL

VFP stores in an EXE/DLL information about what runtime DLL is required to run it.

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

? VfpVersionFromExeOrDll("C:\Program Files\My Company\MyVfpApplication.exe")
? VfpVersionFromExeOrDll("X:\Somefolder\MyVfpDll.dll")
* VfpVersionFromExeOrDll.PRG
FUNCTION VfpVersionFromExeOrDll
LPARAMETERS tcExeDllName
LOCAL lcSig, lnHandle, lcVersion, lcBuffer, lnPos, lcSigMT
lnHandle = FOPEN(tcExeDllName, 0)
IF lnHandle < 0
    ? FERROR()
    RETURN "Unable to Open file + '" + tcExeDllName + "'"
ENDIF

Remove Structural CDX or Memo flag from a table

The VFP low level file functions (LLFF) can be used to open a table as a file and read/write its header. The Table Header Record Structure is documented in VFP help under Table File Structure.


Note 1 Removing Structural CDX flag will effectively disassociate CDX file from the table but not delete the CDX file.

Note 2 Removing Memo flag will allow to open a table and access all fields excluding memo fields. Attempt to access the memo fields will generate an error.

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

Deleting pages from PDF file through Acrobat automation

Detailed info on Acrobat automation can be found in Interapplication Communication API Reference from Acrobat 8.1 SDK or Acrobat 9.0 SDK at http://www.adobe.com/devnet/acrobat/?navID=downloads. Free registration may be required.

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

#DEFINE PDSaveFull	1	&& Write the entire file.

* Original PDF file
lcPdfFile = "..."
* new PDF file with specified pages deleted
lcNewPdfFile = "..."
 
* Delete 3 pages starting with page 5
lnPage2DelStart = 5
lnPage2DelEnd = lnPage2DelStart + 3
* Acrobat application

How to detect 64-bit OS

On 64-bit Windows the 32-bit Windows-based applications run under WOW64 x86 emulator. WOW64 isolates 32-bit applications from 64-bit applications, which includes preventing file and registry collisions. Console, GUI, and service applications are supported. However, 32-bit processes cannot load 64-bit DLLs, and 64-bit processes cannot load 32-bit DLLs.

Retrieve HTML from Clipboard

MSDN:

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

lcHtml = HtmlFromClipboard()
IF NOT ISNULL(lcHtml)
	lnStartHTML = VAL(STREXTRACT(lcHtml, "StartHTML:", ""))
	lnEndHTML = VAL(STREXTRACT(lcHtml, "EndHTML:", ""))
	* If StartFragment is present, retrieve HTML fragment
	IF ("StartFragment" $ lcHtml)

Retrieving Windows TaskBar Size and Location

A location and size of the Windows Taskbar can be retrieved with SHAppBarMessage Function.

Array Browser utility

Array Browser utility is a development tool to view an array content in a Browse window. Useful in analyzing content of the arrays during development process.

How to change file attributes programmatically

There're many ways to change file attributes. It can be done through Windows Explorer, DOS ATTRIB comand, third party utilites, e.t.c. Also it can be done programmatically using Windows Scripting Host (WSH) or/and Windows API.

Preventing BackSpace key in a TextBox from moving a cursor to the previous control

Deleting characters in a TextBox with Backspace key doesn't stop when cursor reaches the beginning position but unexpectedly moves cursor to the previous control. It could cause unintended deletion of the data there.

Check if table is part of DBC

It is easy to find out if a table belongs to the open Database Container (DBC) using INDBC() function. Sometimes it's necessary to check it w/o referring to DBC itself.

Syndicate content