HB_ProgName

HB_ProgName

Returns name and directory of the current Harbour program

Syntax

      HB_ProgName() --> <cProgram>

Returns

<cProgram> : Drive, path and file name of the current .EXE program

Description

This function determines the name and path of the Harbour application in use

Note

This function is synonim of ExeName() and HB_ArgV()

Example

      Determine if the name or path of an EXE file has changed:

      cOrigPath  :=  "C:\DATA\ADDRESS.EXE"
      IF HB_ProgName() <> cOrigPath
         ? "Program name or directory have been changed!"
         QUIT
      ENDIF

Seealso

ExeName(), HB_ArgV(), HB_DirBase()

HB_ArgString

HB_ArgString

Retrieves the vale of an internal switch set on the command line.

Syntax

      HB_ArgString( <cSwitch> ) --> <cValue>

Arguments

<cSwitch> : A string holding the symbolic name of of an internal switch

Returns

If exist <cSwitch> in command line, remain of this switch in the argument, else a null string

Description

There are two kind of internal switches : prefixed and regular. Prefixed internal switches always have two slashes as prefix. This function return value of a prefixed switch.

Example

      // If command line is :  C:\temp>test.exe p1 p2 //p3
      ? HB_ArgString( 'p' ) // 3

Seealso

HB_ArgShift(), HB_ArgC(), HB_ArgCheck(), HB_ArgV(), PCount(), HB_PValue(), HB_AParams()

HB_ArgShift

HB_ArgShift

Updates HB_ARG*() parameter list removing the 1-st one and replacing it by others

Syntax

      HB_ArgShift( [<lProgName>] ) -> NIL

Argument

<lProgName> : If .T. first non internal parameter is moved to hb_argv(0) and all next are shifted.

Returns

NIL

Description

This procedure shifts command line argument each time called and can be used for implementing command line arguments by a loop.

Note

Each time HB_ArgShift() called, return value of HB_ArgC() decremented

Example

      // If command line is :  C:\temp>test.exe p1 p2 //p3 p4 p5
      lProgName := .F.
      nArgC := HB_ArgC()
      FOR nArgNo := 1 TO nArgC // HB_ArgC()     // Each time HB_ArgShift() called, return value of HB_ArgC() decremented
         ? nArgNo, HB_ArgV( 1 )
         HB_ArgShift( lProgName  )
      NEXT
      // Result  :
      // <lProgName>
      // .F.       .T.
      // --------- ---------
      // 1 p1      1 p1
      // 2 p2      2 p2
      // 3 //p3    3 //p3
      // 4 p4      4 //p3
      // 5 p5      5 //p3

Seealso

HB_ArgV(), HB_ArgC(), HB_ArgCheck(), HB_ArgString(), PCount(), HB_PValue(), HB_AParams()

HB_ArgCheck

HB_ArgCheck

Checks existence of an internal switch on the command line

Syntax

      HB_ArgCheck( <cSwitch> ) --> <lExists>

Arguments

<cSwitch> : A character string holding the symbolic name of of an internal switch

Return

.T. (true) when the command line include an internal switch, otherwise .F. (false)

Description

There are two kind of internal switches : prefixed and regular. Prefixed internal switches always have two slashes as prefix. This function tests existence of prefixed switches.

Note

Use function HB_ArgString() to retrieve the value of an internal command line switch

Example

      // If command line is :  C:\temp>test.exe p1 p2 //p3
      ? HB_ArgCheck( 'p' ) // .T.

Seealso

HB_ArgC(), HB_ArgV(), HB_ArgString(), HB_ArgShift(), PCount(), HB_PValue(), HB_AParams()

HB_ArgC

HB_ArgC

Returns the number of command line arguments

Syntax

      HB_ArgC() --> nArgCount

Returns

The function returns the number of command line arguments

Description

When an Harbour application is started, it can be passed arguments from the command line which are received by the initial routine of the application.

HB_ArgC() determines this number of arguments. The contents of command line arguments can be retrieved with function HB_ArgV().

Example

      // If command line is :  C:\temp>test.exe p1 p2
      ? HB_ArgC() // 2

Seealso

HB_ArgV(), HB_ArgCheck(), HB_ArgString(), HB_ArgShift(), PCount(), HB_PValue(), HB_AParams()

ExeName

ExeName

Returns name and directory of the current Harbour program

Syntax

      ExeName() --> <cProgram>

Returns

<cProgram> : Drive, path and file name of the current .EXE program

Description

This function determines the name and path of the Harbour application in use

Note

This function is equivalent of HB_ArgV()

Example

      Determine if the name or path of an EXE file has changed:

      cOrigPath  :=  "C:\DATA\ADDRESS.EXE"
      IF ExeName() <> cOrigPath
         ? "Program name or directory have been changed!"
         QUIT
      ENDIF

Seealso

HB_ArgV(), HB_DirBase()

HB_DirBase

HB_DirBase

Drive and directory name of running executable ( application )

Syntax

      HB_DirBase() -> <cExeFolder>

Argument

None

Returns

<cExeFolder> : Folder name of running .exe

Description

HB_DirBase() returns folder name of application

Example :

      HB_DirBase() is equivalent to :

      LEFT( ExeName(), RAT( '\', ExeName() ) )

      and

      HB_FNameDir( ExeName() )

      and

      cExeDir := ''
      HB_FNameSplit( ExeName(), @cExeDir )

Seealso

HB_ArgV(), ExeName(), HB_FNameDir(), HB_FNameSplit()