path of an image

Re: path of an image

Postby MdaSolution » Thu Sep 08, 2011 9:48 am

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
MdaSolution
 
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: path of an image

Postby Rick Lipkin » Thu Sep 08, 2011 12:44 pm

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  Expand view

//-- 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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: path of an image

Postby hmpaquito » Fri Sep 09, 2011 3:50 pm

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  Expand view

PathProgram=\ProgramDir\Account
 


So .exe is launched in something directory and path data is independent from .exe.

Just, my 2 cents
regards
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 54 guests