Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Reading .INI files

Author
Message
wargamer
21
Years of Service
User Offline
Joined: 7th Jan 2003
Location: United Kingdom
Posted: 30th Jul 2003 16:48
I once downloaded a dll called inifiles.dll which contains functions to read and write .ini files, but I can't remember where I got it from and have no documentation on it :-s . Anyone know what the functions are and how to use them?


There are some similar functions in KRNL386.exe (GetPrivateProfieString etc) but as it's not a proper dll you can't use LOAD DLL etc. Any thoughts on how to take this approach?

Any other suggesttions??
AMD Athlon 1600+, 512MB, GeForce 3
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 30th Jul 2003 17:19
I think MrTatoad has a plugin similar to the one you mentioned on his home software site. I forgot the link but maybe he will post here and there is documentation available on his site for the plugin i think

"We are getting aggravated"
"Yes, we are"
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 30th Jul 2003 19:28
Forgotten the link ? Deary me... I obviously dont post enough...


Its better than a poke in the eye...
wargamer
21
Years of Service
User Offline
Joined: 7th Jan 2003
Location: United Kingdom
Posted: 31st Jul 2003 01:18
Thanks Toad, I'm not worthy!

But is there an easier way to extract the string data than using calloc and peekstring$? (I haven't installed that plugin yet).

AMD Athlon 1600+, 512MB, GeForce 3
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 31st Jul 2003 01:40 Edited at: 31st Jul 2003 01:43
No, because it returns a status value (success or failure) + the result. Its not actually a status values, its more like the number of characters in the buffer. I may re-do it (much) later to be more DBPro 'friendly'...


Its better than a poke in the eye...
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 31st Jul 2003 01:59
Put the source in the button in a separate file and 'include' it into your project.

You would use it like this:

wargamer
21
Years of Service
User Offline
Joined: 7th Jan 2003
Location: United Kingdom
Posted: 31st Jul 2003 11:49
Thanks guys - will now try both approaches.

AMD Athlon 1600+, 512MB, GeForce 3
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 31st Jul 2003 11:58
Prefably the plug-in way, of course...


Its better than a poke in the eye...
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 31st Jul 2003 18:29
@Toady

I think you need to change the way your plugins work. Wouldn't it be easier to have the INI read command return the string (or a blank string if nothing was found), and then an INI OPERATION SUCCESS() function which returns 0 or 1 depending on whether or not the last operation worked?

MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 31st Jul 2003 21:30
The problem is I dont know the size of the string read - I would have to limit it and then pass the string back. I'm thinking of limiting it to say, 64K; any more, and it gets truncated; less and its okay.


Its better than a poke in the eye...
wargamer
21
Years of Service
User Offline
Joined: 7th Jan 2003
Location: United Kingdom
Posted: 1st Aug 2003 14:41
And the result was......

I used IanM's approach and it works fine (sorry Toady, I'm all for the easy life!)

One thing tho' Ian - I actually used the raw dll calls and for reading integers the call should be to:

GetPrivateProfileIntA (ie with an "A" on the end), at least in WinXP

Thanks again, both of you.

AMD Athlon 1600+, 512MB, GeForce 3
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 1st Aug 2003 15:09
Oops, how did I make that mistake?

I'll update my library code. Thanks
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 1st Aug 2003 17:07
Fair enough... I suppose...


Its better than a poke in the eye...
Yukito
20
Years of Service
User Offline
Joined: 1st Aug 2003
Location: Khorinis
Posted: 1st Aug 2003 23:48
An easy way to find put what functions are in a dll is to open the following folders...

compiler
user-plugins

there is a bat-file!
duplicate it

then change the copied file with editor
to change are the mentioned dll file to yours (of course you have to copy yours into the folder) and the output file (txt)

run the bat-file! ta-dah!!!
in the output file you will find all funcs of the dll!!!

Complex
21
Years of Service
User Offline
Joined: 27th Apr 2003
Location:
Posted: 4th Aug 2003 01:31
@ Ian

I was using your code very gratefully until I needed to use the "WritePrivateProfileInt" function and found that the DLL doesn't have it. The "GetPrivateProfileIntA" is there, but the former isn't both with and with out the extra A added.

Is there a work around this or am I missing something?

I have Win XP

Cheers

All your base are belong to us
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 4th Aug 2003 01:37 Edited at: 4th Aug 2003 01:42
There is no actual function for writing integers - I have one in my plug-in though, which gets around this problem...
However, if your not using P5, then it wont work...


Logo design by Indi
Its better than a poke in the eye...
Complex
21
Years of Service
User Offline
Joined: 27th Apr 2003
Location:
Posted: 4th Aug 2003 02:28
I assumed that as their was a function in IanM's function list called "WritePrivateProfileInt" that it was the optimum way to do that, thanks for the info Toady

However I'm going to wait until the official release of P5 so I can build my project on a more stable foundation.

I'll just have to wait.

Cheers

All your base are belong to us
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th Aug 2003 20:59
Errr ... whoops
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 4th Aug 2003 21:22
I suggest you bounce along to my web site and download the appropriate plug-in - that can handle strings & integers...


Logo design by Indi
Its better than a poke in the eye...
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th Aug 2003 22:04
... or just replace the 'Int' functions with these:

MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 4th Aug 2003 22:31 Edited at: 4th Aug 2003 22:33
Wondering how long it would take you to do a couple of functions.
Whats wrong with GetPrivateProfileInt though ??

I still recommend my plug-ins though...


Logo design by Indi
Its better than a poke in the eye...
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th Aug 2003 22:51
Ok, smart-pants
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 5th Aug 2003 01:25
Who? Me ?


Logo design by Indi
Its better than a poke in the eye...
Complex
21
Years of Service
User Offline
Joined: 27th Apr 2003
Location:
Posted: 5th Aug 2003 19:07
Is there any way to store floating point values in an INI? I've seen other programs do it, but the functions by IanM don't seem to recall anything after the decimal point.

Thanks

All your base are belong to us
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 5th Aug 2003 19:36
Its easy enough to do - might add it later to my plug-in...


Logo design by Indi
Its better than a poke in the eye...
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Aug 2003 20:13 Edited at: 5th Aug 2003 20:13
You could just make alternate versions of the Int code, like this:



I don't know how much precision that STR$() keeps when it makes the string though...
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 5th Aug 2003 20:30
I already had one for reading - just need to do one for writing


Logo design by Indi
Its better than a poke in the eye...
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 5th Aug 2003 21:27
Sorted...


Logo design by Indi
Its better than a poke in the eye...

Login to post a reply

Server time is: 2024-05-09 18:42:48
Your offset time is: 2024-05-09 18:42:48