MOL (Marek Olszewski)

Contributed samples by MOL (Marek Olszewski)

Backup-Restore

Billing System ( definable buttons )

Calculator

Copy To Clipboard

Deactivate menu

Debug Message

Download from www

EAN13 BarCode Generator

Filter in Browse

HMG with MS SQL server

Incremental Search in BROWSE 

Menu like ACHOICE

Moldruk (Print like DOS )

Set Status Bar Item

Send mails via SMTP

Using ProgressBar as a graph

HB_FNameExists

HB_FNameExists

Tests for the existence of a file or a directory

Syntax

      File( <cFileSpec> ) --> lExists

Argument

<cFileSpec> : Exact file name to find

Returns

<lExists> : true (.T.) if the file exists or logical false (.F.)

Description

This function return a logical true (.T.) if the given filename <cFileSpec> exist

Note

HB_FNameExists() don’t accept wildcard characters

Example

      Assuming this directory tree and files exist :

      C:\
         | temp                     D
         + ---- + Dir1              D
                |      doc1.docx    F
                |      test1.bat    F
                |      test1.txt    F
                + Dir2              D
                       doc2.docx    F
                       test2.bat    F
                       test2.txt    F

      ? HB_FNameExists( 'C:\' )                        //  .T.
      ? HB_FNameExists( 'C:\*.*' )                     //  .F.
      ? HB_FNameExists( 'C:\temp\*.*' )                //  .F.
      ? HB_FNameExists( 'C:\temp\*.' )                 //  .F.
      ? HB_FNameExists( 'C:\temp\test*.*' )            //  .F.
      ? HB_FNameExists( 'C:\temp\test.bat' )           //  .T.
      ? HB_FNameExists( 'C:\temp\Dir' )                //  .F.
      ? HB_FNameExists( 'C:\temp\Dir*.*' )             //  .F.
      ? HB_FNameExists( 'C:\temp\Dir1' )               //  .T.
      ? HB_FNameExists( 'C:\temp\Dir1*' )              //  .F.
      ? HB_FNameExists( 'C:\temp\Dir2' )               //  .T.
      ? HB_FNameExists( 'C:\temp\Dir2*' )              //  .F.
      ? HB_FNameExists( 'C:\temp\Dir1\test1.*' )       //  .F.
      ? HB_FNameExists( 'C:\temp\Dir1\test1.bat' )     //  .T.
      ? HB_FNameExists( 'C:\temp\Dir1\*.bat' )         //  .F.

File

Library is rtl

Seealso:

SET DEFAULT, SET PATH, SET(), Directory(), File(), IsDirectory(), IsDir(), HB_FileExists(), HB_DirExists()

HB_FileExists

HB_FileExists

Tests for the existence of a file

Syntax

      HB_FileExists( <cFileSpec> ) --> <lExist>

Arguments

<cFileSpec> : A character string holding the relative or absolute name of a file

Return

<lFileExist> : .T. (true) when the file <cFileSpec> exists, otherwise .F. (false) is returned.

Description

The HB_FileExists() function is used to check if a file exists that matches the specification <lFileExist>.

This is a character string containing the absolute or relative path of a file.

Note

HB_FileExists() is a Harbour level function to check for the existence of a file. This works better than FILE() in most situations, but it doesn’t accept any wildcards.

Example

      Assuming this directory tree and files exist :

      C:\
         | temp                     D
         + ---- + Dir1              D
                |      doc1.docx    F
                |      test1.bat    F
                |      test1.txt    F
                + Dir2              D
                       doc2.docx    F
                       test2.bat    F
                       test2.txt    F

      ? HB_FileExists( 'C:\' )                        //  .F.
      ? HB_FileExists( 'C:\*.*' )                     //  .F.
      ? HB_FileExists( 'C:\temp\*.*' )                //  .F.
      ? HB_FileExists( 'C:\temp\*.' )                 //  .F.
      ? HB_FileExists( 'C:\temp\test*.*' )            //  .F.
      ? HB_FileExists( 'C:\temp\test.bat' )           //  .T.
      ? HB_FileExists( 'C:\temp\Dir' )                //  .F.
      ? HB_FileExists( 'C:\temp\Dir*.*' )             //  .F.
      ? HB_FileExists( 'C:\temp\Dir1' )               //  .F.
      ? HB_FileExists( 'C:\temp\Dir1*' )              //  .F.
      ? HB_FileExists( 'C:\temp\Dir2' )               //  .F.
      ? HB_FileExists( 'C:\temp\Dir2*' )              //  .F.
      ? HB_FileExists( 'C:\temp\Dir1\test1.*' )       //  .F.
      ? HB_FileExists( 'C:\temp\Dir1\test1.bat' )     //  .T.
      ? HB_FileExists( 'C:\temp\Dir1\*.bat' )         //  .F.

Seealso

SET DEFAULT, SET PATH, SET(), Directory(), File(),  IsDirectory(), IsDir(), HB_FNameExists(), HB_DirExists()

SET MBLOCKSIZE

SET MBLOCKSIZE

Change the block size for memo files

Syntax

      SET MBLOCKSIZE TO <nSize>

Arguments

<nSize> is the memo file block size in bytes. The initial memo file block size depends on the RDD. For most drivers that support the .dbt memo file format, it is 512 bytes. However, if you are using BLOB files (.dbv memo file format) via inheritance from the DBFMEMO driver, the default is 1.

Description

SET MBLOCKSIZE is functionally equivalent to calling DBINFO( DBI_MBLOCKSIZESIZE, <nSize>). Refer to this function for more information. SET MBLOCKSIZE sets the block size for the memo file associated with the database.

The block size is the minimum amount of space in bytes allocated in memo files when storing character strings in memo fields.

The initial memo block size depends on the replaceable database driver used to open a database in a work area.

The following table lists the default sizes for memo blocks of RDDs shipped with Harbour:

Default memo block sizes

         Memo type Block size Changeable
         --------- ---------- ----------
             DBT      512     No
             FPT       64     Yes
             SMT       64     Yes

Examples

      .  The following example illustrates the SET MBLOCKSIZE command:
      USE Inventor NEW
      SET MBLOCKSIZE TO 256
      ? DBINFO(DBI_MBLOCKSIZESIZE)         // Result: 256

Seealso

DBINFO(), RddSetDefault(), Set()

SET STRICTREAD

SET STRICTREAD

Toggles read optimization for database access.

Syntax

      SET STRICTREAD on | OFF | ( <lOnOff> )

Arguments

on | OFF | ( <lOnOff> ) The option toggles whether or not internal memory buffers are used for loading field variables into memory variables. The default is OFF, or .F. (false). When set to ON or .T. (true), performance optimization is suppressed

Description

SET STRICTREAD is part of xHarbour’s optimization for database access. This is accomplished by means of internal memory buffers used to hold the contents of field variables. If field variables must be accessed that are held in a buffer already, no file access is required when SET STRICTREAD is set to OFF. This is the default and optimizes field access.

When SET STRICTREAD is set to ON, the contents of field variables are always read from disk.

Seealso

Set(), SET OPTIMIZE

SET AUTOSHARE

SET AUTOSHARE

Defines network detection for shared file access.

Syntax

      SET AUTOSHARE TO [<nMode>]

Arguments

<nMode> A numeric value 0, 1 or 2 can be specified for <nMode>. The default is 0. If omitted, the network detection mode is switched off.

Description

SET AUTOSHARE is a compatibility command useful for changing a multi-user application to a stand-alone application by changing one line of code in the start routine of a program.

This requires changing only the value of <nMode>:

                    Values for SHARE mode detection
         ---------------------------------------------------------
         Value   Description
         -----   -------------------------------------------------
           0     Disables SHARE mode detection ( default )
           1     Opens database SHARED in a network, and EXCLUSIVE
                 if no network is detected
           2     Always opens databases EXCLUSIVE

To take advantage of SET AUTOSHARE, an application must be programmed for multi-user access, respecting the rules for network programming. For example, record locks must be obtained with RLock() before changing field variables. This way, a multi-user application is created.

To change this application to a single user version, SET AUTOSHARE TO 2 is coded in the start routine.

A developer can SET AUTOMODE TO 1 on the development machine. In this case, performance advantages from EXCLUSIVE file access are available during the development cycle, while SHARED file access is granted in a multi-user environment.

Seealso

Set(), SET AUTOPEN, SET AUTORDER, USE

SET AUTORDER

SET AUTORDER

Defines the default controlling index for automatically opened index files.

Syntax

      SET AUTORDER TO <nOrder>

Arguments

<nOrder> This is a numeric value specifying the ordinal position of the index to select as the controlling index when SET AUTOPEN is set to ON. The default is zero.

Description

When SET AUTOPEN is set to ON and the RDD supports automatic opening of structural indexes, the SET AUTORDER command specifies the index to activate as the controlling index. The default value for <nOrder> is zero, i.e. no controlling index is activated when an index file is automatically opened with the USE command. In this case, records of the database are accessible in physical order in the work area.

Note

Refer to SET AUTOPEN for an example of automatic selection of the controlling index.

Seealso

OrdSetFocus(), Set(), SET AUTOPEN, SET AUTOSHARE, USE

SET AUTOPEN

SET AUTOPEN

Toggles automatic opening of a structural index file

Syntax

      SET AUTOPEN ON | off | (<lOnOff>)

Arguments

ON | off | (<lOnOff>) The option toggles if a structural index file is automatically opened with the USE command. With ON or .T. (true), an index file is automatically opened. OFF or .F. (false) switch this mode off.

Description

Some replaceable database drivers support automatic opening of index files with the USE command when the index file has the same file name as the database file (without extension). An example is the DBFCDX driver. SET AUTOPEN toggles this behavior.

When SET AUTOPEN is set to ON, which is the default, the USE command automatically opens an index file having the same name as the database file and the file extension returned from OrdBagExt().

Note

If an index file is automatically opened, a controlling index is not activated. The default index order is zero, i.e. records are accessible in physical order in the work area. To select a controlling index, call OrdSetFocus() or use SET AUTORDER for a default controlling index

Example

      // The example demonstrates the effect of SET AUTOPEN with the
      // DBFCDX driver.

      REQUEST DBFCDX

      PROCEDURE Main

         RddSetDefault( "DBFCDX" )
         SET AUTOPEN OFF

         USE Customer
         INDEX ON CustID                    TAG ID   TO Customer
         INDEX ON Upper(LastName+FirstName) TAG Name TO Customer

          USE Customer
          ? OrdCount(), OrdKey()        // result: 0  ""

          SET AUTOPEN ON

          USE Customer
          ? OrdCount(), OrdKey()        // result: 2  ""

          SET AUTORDER TO 1

          USE Customer
          ? OrdCount(), OrdKey()        // result: 2  CUSTID
          ? Ordkey( 2 )                 // result: Upper(LastName+FirstName)

          USE
       RETURN

Seealso

OrdListAdd(), OrdSetFocus(), Set(), SET AUTORDER, SET AUTOSHARE, USE

Harbour All Functions – S

SaveToken

SayScreen

Seconds
Secs

Select

Set

SetAtLike

SetDate

SetKey

SetMode

SetPrec

SetTime

SetTypeahead

Sign

Sin

SinH

Space

Sqrt

Str

StrDiff

StrFormat

StrSwap
StrTran
StrZero
SubStr