Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i keep path info in INI file 2

Status
Not open for further replies.

kosta

Programmer
Feb 9, 2001
186
0
0
CA
Hi All,
i am keeping path info on the dbf (pathinfo.mypath) like this "K:\quiksilver\plan" a network map path . When my application start it controls if the pathinfo.dbf mypath field is empty or not . if empty comes a form for select where is data file . After select its continiue to run . But now i want to keep it on INI file . by this way no need to control pathinfo.mypath empty or not . Once i'll set the information and i'll use this INI file on each client machine.

How can design the ini file and what should i do on foxpro side ?

TIA
Soykan OZCELIK
Comp.Prog / MSFoxPro Programmer Developer
 
kosta

Why not use the config.fpw? Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike,
Yeah i didn't it never before :) how should be syntax ?

And also i've send to you mail about your "Myclass.vcx"
that you send me it before . Please check out your mailbox i need some help from you ...

TIA Soykan OZCELIK
Comp.Prog / MSFoxPro Programmer Developer
 
kosta

Here is an example :
DEFAULT = HOME() && Sets the default directory of the application to VFP's directory
CLOCK = ON && Sets the clock on.

Please note that you need to start the application via an icon on the desktop for the cofig file settings to take effect.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
kosta

And also i've send to you mail about your "Myclass.vcx"
that you send me it before . Please check out your mailbox i need some help from you ...


I didn't receive it, plese resend.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thanks for the reply Mike,

i had decided to use your "myclass.vcx" for my apps, that you send me before . i've tried to apply your order samples to my programs i was succesful but "AddOrder to Detail" button code doesnt work with my samples . a another say doesnt add new record to the child table. why ? i have only changed child table name and its field name ...

And i you have enough time i wish from you would you like change button captions with images or like with << , < ,> ,>> ,+ ,- and related codes on the class .By this way it can use on every language .

TIA and mery christmas for you ....

Soykan OZCELIK
soykanozcelik@web.de
ICQ# 93291682
Soykan OZCELIK
Comp.Prog / MSFoxPro Programmer Developer
 
I've send it to mike.gagnon@slpcanada.com adress Mike ... Soykan OZCELIK
Comp.Prog / MSFoxPro Programmer Developer
 
Kosta

Change the caption to the appropriate character.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
But i think this not enough why some codes using &quot;Add&quot;,&quot;Edit&quot; clause on the class and form . That's way i dont wantto edit it . would you like check and edit it forme for these characters . And a question is here any way to create more basic this navigation system for ex. all of defined methods properties can be define on the class ?

TIA Soykan OZCELIK
Comp.Prog / MSFoxPro Programmer Developer
 
kosta

If you use the form wizard, the options for the buttons are text or pictures. To make it international, use the pictures instead. There are some pictures samples in the VFP directory. Remove the caption and use the &quot;picture&quot; property of the button instead. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
basically an INI file looks like:
[ignore][Section][/ignore]
key=value

BAsically you need two functions to write to and read from an inifile

Those functions are:
GetPrivateProfileString and WritePrivateProfileString

Both reside in the Kernel32

WritePrivateProfileString has 4 parameters
cSectionName
cKeyname
cValueToStore
cPathAndnameOfIniFile

GetPrivateProfileString has 6 parameters
cSectionName
cKeyname
cDefaultReturnValue
cBufferWhereReadValueIsStored
nLengthOfBuffer
cPathAndnameOfIniFile
It returns an integer, deining the number of read characters.

Therefore the syntax to declare either function is
Declare Integer GetPrivateProfileString in Kernel32 ;
string, string, string, string @, integer, string

DECLARE integer WritePrivateProfileString in Kernel32 ;
string, string, string, string

To place a value in the inifile (assumed MyIniFile.ini in the current directory)
?WritePrivateprofileString(&quot;MySection&quot;,&quot;MyKey&quot;,&quot;Key1Value&quot;,addbs(fullpath(curdir()))+&quot;MyIniFile.ini&quot;)

if a 1 is returned, writing was succesful, a 0 (zero) indicates a failure. The integer is actually a boolean value.
Out of the blue, automagically there is a MyIniFile.ini in the directory, created by this call.

It should look like:
[ignore][MySection][/ignore]
Mykey=Key1Value

To read the value:
lcBuffer = space(255)
?GetPrivateProfileString( &quot;MySection&quot;,&quot;MyKey&quot;,&quot;&quot;,@lcBuffer, Len(lcBuffer), addbs(fullpath(curdir()))+&quot;MyIniFile.ini&quot;)

The returned value indicates the number of bytes read.
There are two more things we need to do:
Strip of the trailing chr(0) with
lcBuffer = strtran(lcBuffer,chr(0),&quot;&quot;)
and trim it
lcBuffer = alltrim(lcBuffer)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top