From: CA VO on
What is the best way to find out from what directory did the
application start from, ie the installation directory?
I have some additional parameters in that directory I need to read
later in the application.

Kari
From: Lars Broberg on
We use:
_DLL FUNC GetModuleFileName(hModule AS PTR,lpFilename AS PSZ, nSize AS
DWORD);
AS DWORD PASCAL:KERNEL32.GetModuleFileNameA

to check where we started. You get the fully qualified file name for
your program, from this you can extract the path.

Maybe there is an easier way, this is something we used for a long time...

----
Lars Broberg
Elbe-Data AB
lars at elbe-data dot se


CA VO wrote:
> What is the best way to find out from what directory did the
> application start from, ie the installation directory?
> I have some additional parameters in that directory I need to read
> later in the application.
>
> Kari
From: Johan Nel on
Hi Kari,

I have the following in all my programs:

FUNCTION GetProgramFS() AS FileSpec
RETURN FileSpec{GetProgramName()} // Convert it to a FileSpec object

FUNCTION GetProgramName() AS STRING
LOCAL cExeName AS STRING
LOCAL nLen AS WORD

// This will use the Windows API call "GetModuleFileName"
// to get the currently running task's name and path.
// Example: "C:\CAVO\USING_VO.EXE"

cExeName := Space(128) // Pre-assign a buffer for Windows API call
nLen := GetModuleFileName(_GetInst(), PSZ(cExeName), 128) // Call Windows

IF nLen > 0
cExeName := Left(cExeName,nLen) // Trim to given size
ELSE
cExeName := "" // Error
ENDIF

RETURN cExeName

HTH,

Johan Nel
Pretoria, South Africa.

CA VO wrote:
> What is the best way to find out from what directory did the
> application start from, ie the installation directory?
> I have some additional parameters in that directory I need to read
> later in the application.
>
> Kari
From: John Martens on
If you are also looking for the parameter that were passed while
starting the app look also at: _GetCmdLine()

John


Op 15-2-2010 15:34, CA VO schreef:
> What is the best way to find out from what directory did the
> application start from, ie the installation directory?
> I have some additional parameters in that directory I need to read
> later in the application.
>
> Kari
From: Geoff Schaller on
WorkDir()


"CA VO" <kari.hyvonen(a)dbcoy.com> wrote in message
news:94b4dd3f-6b15-40e2-ab5f-2c6f3a5ed21e(a)d27g2000yqf.googlegroups.com:

> What is the best way to find out from what directory did the
> application start from, ie the installation directory?
> I have some additional parameters in that directory I need to read
> later in the application.
>
> Kari