path of an image

User avatar
MdaSolution
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: path of an image

Post by MdaSolution »

yes Bayron,

But I not Know the folder

sample : .\bitmaps\risto\cafe\cafe.jpg

the user can insert bitmap from .\bitmaps\risto\cafe\ or .\bitmaps\risto\ or .\bitmaps\

I don't Know where
FWH .. BC582.. xharbour
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: path of an image

Post by Rick Lipkin »

I think Bayron is on the right track .. I use the same logic to find the location of the exe that the workstation opened ..

Code: Select all

//-- get timestamp on .exe //

cFILE := GetModuleFileName( GetInstance() )
aDIR  := DIRECTORY( cFILE )
dEXE  := aDIR[1] [3]

// where .exe started from is default directory //

mSTART := RAT( "\", cFILE )
cDEFA  := SUBSTR(cFILE,1,mSTART-1)

aDIR := NIL

SET DEFA to ( cDEFA )

The important part of this code is setting Set Defa to .. location of your exe. This allows you to globally set the location of your app to not only open your tables but to have a starting point for calling your icons and bitmaps ..

It does not matter if you are connecting via a logical drive or by a network path or unc such as :

c:\apps\yourapp.exe
g:\apps\yourapp.exe
\\server\apps\yourapp.exe

By identifying the location of your executable .. you can globally set your Default and anywhere in your app you can get that default by

cDEFA := SET(7) .. returns one of the above paths .. then using that variable get your bitmaps like

cDEFA := SET(7)

DEFINE BITMAP oBMAP FILENAME (cDEFA+"\bitmaps\risto\cafe\cafe.bmp") of oWnd

Hope that helps.

Rick Lipkin
hmpaquito
Posts: 1200
Joined: Thu Oct 30, 2008 2:37 pm

Re: path of an image

Post by hmpaquito »

Hi,

My scheme is:

.exe program+ .ini path configuration in same directory, and separated data directory


Example:

Account.Exe and Account.Ini in something directory.

Run.Ini contents:

Code: Select all

PathProgram=\ProgramDir\Account
 
So .exe is launched in something directory and path data is independent from .exe.

Just, my 2 cents
regards
Post Reply