Sergey's blog

Get rid of annoying security alerts in Microsoft Outlook

The Advanced Security for Outlook from http://www.mapilab.com/outlook/security/ is free Outlook add-in that allows end-user to take control over Outlook security alerts.

Fix VFP file associations to open files in one VFP instance

The files associated with VFP are opened in a new instance of VFP when double-clicked or 'Open' verb is executed on them. It's configured in Windows not in VFP.

Cannot access the selected table (Error 1152)

The error is related to the RowSource or ControlSource of a ListBox/ComboBox.

Possible sources of this error:

  1. The RowSource cursor for ListBox/ComboBox has been closed or recreated in another work area. It seems that a ListBox/ComboBox remembers connection with its RowSource by workarea number not by alias. Setting ListBox/ComboBox RowSource to an empty string before query is run and restoring after would help.

Is user a member of the Administrators group

Sometimes it's important to know if application is running under account that is a member of the Administrators group. There're a few ways to accomplish that.

Obtaining DLL-specific version information

Most Windows Shell and common controls DLLs implement DllGetVersion function. It allows applications to obtain DLL-specific version information to make sure that required functionality in a DLL is implemented.
The Windows API support class is used to handle Windows API structures.

$SAMPLECODE$


#DEFINE DLLVER_PLATFORM_WINDOWS 1
#DEFINE DLLVER_PLATFORM_NT 2

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:

$SAMPLECODE$

FUNCTION GenerateGUID
LOCAL lcGUID, lcStrucGUID, lnSize
lcStrucGUID = SPACE (16)
lcGUID = SPACE (78)
lnSize = LEN(lcGUID)/2

Creating directory preserving name case

MSDN:

$SAMPLECODE$

Counting lines in an ASCII file

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

$SAMPLECODE$


* #1
CREATE CURSOR test (C(1))
APPEND FROM (lcAsciiFileName) TYPE SDF
lnRecCount = _TALLY
USE IN temp

* # 2. The line length cannot exceed 8192 bytes. Would return 1 for empty file
lnRecCount = 0
lnFH = FOPEN(lcAsciiFileName)
DO WHILE NOT FEOF(lnFH)
= FGET(lnFH, 8192)
lnRecCount = lnRecCount + 1
ENDDO

Pages

Subscribe to RSS - Sergey's blog