|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Ini File
Hello again everyone!
![]() Okay, I want to do this: I got an ini file, called Launcher.ini, that looks like this: (The sites are just examples, and the Website, Register, and NewsPage are also the name of the Var's) Code:
[Settings] Website = google.com RegisterPage = Youtube.com NewsPage = devshed.com This is the ini fiile code: Code:
JeffijoeINI:=TInifile.Create(GetCurrentDir+'Launcher.ini');
RegisterPage:=JeffijoeINI.ReadString('Settings','RegisterPage','');
Website:=JeffijoeINI.ReadString('Settings','Website','');
NewsPage:=JeffijoeINI.ReadString('Settings','NewsPage','');
And I wanna do a ShellExecute like this: Code:
ShellExecute(Handle, 'open', Pchar (RegisterPage) ,nil, nil, SW_SHOWMAXIMIZED) ; But when I press the button which has that code, it just opens the directory where the Launcher.ini is, but I wanted it to open the RegisterPage value, which is youtube.com. Now, if I do this: Code:
RegisterPage:=JeffijoeINI.ReadString('Settings','RegisterPage','somesitehere.com');
Then, it goes to that somesitehere.com (examble, but you should be able to see that), but it wont go to the site specified in the ini. Do you guys know whats wrong? Thanks. -Jeff |
|
#2
|
|||
|
|||
|
Have you actually checked the values being returned into your variables?
If you are going to 'somesitehere.com' that would indicate that RegisterPage is empty. A long time since I used an ini file, are you allowed spaces round the equals sign? |
|
#3
|
|||
|
|||
|
I checked, yeah. Let me check the spaces thing..
Well, deleting the spaces didnt do anything either. Any other idea? |
|
#4
|
|||
|
|||
|
Quote:
So what were the values? - Exactly |
|
#5
|
|||
|
|||
|
Quote:
You mean in the ini file, right? If so, you can see it in my first post. |
|
#6
|
|||
|
|||
|
Quote:
No I mean in the variables you declared after the ReadString. Have you also checked the value of: GetCurrentDir+'Launcher.ini'? Perhaps GetCurrentDir is not pointing where you think it is. Perhaps you need to add a backslash GetCurrentDir+'\Launcher.ini' You should have checked aall those things as soon as you ran into trouble. Clive |
|
#7
|
|||
|
|||
|
Quote:
I forgot the backslash, thanks xD |
|
#8
|
|||
|
|||
|
Forgot Backslash
It's good practice to use the IncludeTrailingBackslash and ExcludeTrailingBackslash functions (superceded by IncludeTrailingPathDelimiter and ExcludeTrailingPathDelimiter in newer versions) to prevent this type of problem.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Delphi Programming > Ini File |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|