sx_DbfEncrypt

<< Click to Display Table of Contents >>

Navigation:  Apollo API Listing >

sx_DbfEncrypt

VB Declaration

Declare Function sx_DbfEncrypt Lib "Apollo9.dll" () As Integer

C Declaration

BOOL FAR PASCAL sx_DbfEncrypt (VOID);

Description

Encrypts all records in a table (that have not as yet been encrypted) using the encoding key set via sx_SetPassword.

Once sx_SetPassword has been issued with an encoding key, records are automatically encrypted when they are written, and automatically decrypted when they are read. Use sx_DbfEncrypt to encrypt an existing un-encrypted table and/or use it to ensure that other xBase programs cannot read the table. One of the functions of sx_DbfEncrypt is to alter the table header to make it incompatible with standard xBase programs.

The password used in encrypting the table must be set via sx_SetPassword. If a password has not been set, no encrypting takes place.

The progress of the function may be visually monitored if a gauge hook has been set with sx_SetGaugeHook.

The file should be opened for exclusive use before encrypting or decrypting.

Return Value

True if the function is successful and False if not.

VB Example

' Encrypt a database

sx_SetPassword "HANDEL"

If Not sx_DbfEncrypt() Then

MsgBox "Database encrypting failed"

End If

C Example

void CNamesForm::OnButtonEncrypt()

{

sx_SetPassword("HANDEL");

if (!sx_DbfEncrypt())

AfxMessageBox((LPCSTR) "Database encrypting failed.");

}

See Also

sx_DbfDecrypt, sx_SetGaugeHook, sx_SetPassword