App Start Directory

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

App Start Directory

Post by AUGE_OHR »

hi,

i do have

Code: Select all

   zPATH := HB_CurDrive() + ':\' + CURDIR() + '\'
   USE (ZPATH+"WMPSETUP.DBF") ALIAS WMPSETUP SHARED
let say App is in C:\MYDIR and i start with
C:\MYDIR\MyApp.EXE
from C:\Somewhere

than zPATH is NOT C:\MYDIR ... it is C:\Somewhere :o
so how to get App Start Directory :idea:
have fun
Jimmy
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: App Start Directory

Post by SALINETAS24 »

AUGE_OHR wrote: Sun May 09, 2021 10:33 am hi,

i do have

Code: Select all

   zPATH := HB_CurDrive() + ':\' + CURDIR() + '\'
   USE (ZPATH+"WMPSETUP.DBF") ALIAS WMPSETUP SHARED
let say App is in C:\MYDIR and i start with
C:\MYDIR\MyApp.EXE
from C:\Somewhere

than zPATH is NOT C:\MYDIR ... it is C:\Somewhere :o
so how to get App Start Directory :idea:
No termino de entender, :oops:
Pero quizas buscas esto

GetCurrentFolder()

Te devuelve el Directorio donde estas ejecutando el programa

Sl2
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: App Start Directory

Post by AUGE_OHR »

hi,
SALINETAS24 wrote: Sun May 09, 2021 10:53 am No termino de entender, :oops:
Pero quizas buscas esto

GetCurrentFolder()

Te devuelve el Directorio donde estas ejecutando el programa
thx for Answer.

it does give me Folder where i start external App, not where App exist.

---

Code for "C:\MYDIR\MyApp.EXE"

Code: Select all

PROCEDURE MAIN
LOCAL cDIr := GetCurrentFolder()
   MsgInfo(cDIr)
now try to start from "C:\Somewhere" and call "C:\MYDIR\MyApp.EXE"
GetCurrentFolder() give me "C:\Somewhere" not "C:\MYDIR"
have fun
Jimmy
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: App Start Directory

Post by mustafa »

maybe ?

Code: Select all

  cDir1 := HB_CurDrive()+':\'+CurDir()+'\'
  cDir2 := HB_CurDrive()+':\'+CurDir()+'\Docs\'

  DIRCHANGE( cDir1)
  DIRCHANGE( cDir2)

Saludos/Regards/Salam
Mustafa
edk
Posts: 911
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: App Start Directory

Post by edk »

hb_DirBase() ➜ cDirName
returns the application's executable base directory (program statrtup directory).

hb_ProgName() ➜ cExeName
returns the executable program name.
hansmarc
Posts: 40
Joined: Thu Jun 23, 2016 5:38 am
Location: Belgium

Re: App Start Directory

Post by hansmarc »

Hi Jimmy,

use hb_dirbase()

regards
Hans
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: App Start Directory

Post by AUGE_OHR »

hi
edk wrote: Sun May 09, 2021 12:08 pm hb_DirBase() ➜ cDirName
returns the application's executable base directory (program statrtup directory).

hb_ProgName() ➜ cExeName
returns the executable program name.
YES ... hb_DirBase() work like i want, THX
have fun
Jimmy
Post Reply