Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 24th, 2009, 11:39 AM
jeffijoe jeffijoe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 50 jeffijoe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 15 m 39 sec
Reputation Power: 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

Reply With Quote
  #2  
Old June 24th, 2009, 01:31 PM
clivew clivew is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2006
Location: Carlsbad, CA
Posts: 1,124 clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 6 Days 1 h 39 m 23 sec
Reputation Power: 272
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?

Reply With Quote
  #3  
Old June 24th, 2009, 02:00 PM
jeffijoe jeffijoe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 50 jeffijoe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 15 m 39 sec
Reputation Power: 1
I checked, yeah. Let me check the spaces thing..

Well, deleting the spaces didnt do anything either.

Any other idea?

Reply With Quote
  #4  
Old June 24th, 2009, 03:20 PM
clivew clivew is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2006
Location: Carlsbad, CA
Posts: 1,124 clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 6 Days 1 h 39 m 23 sec
Reputation Power: 272
Quote:
I checked, yeah.

So what were the values? - Exactly

Reply With Quote
  #5  
Old June 24th, 2009, 03:21 PM
jeffijoe jeffijoe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 50 jeffijoe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 15 m 39 sec
Reputation Power: 1
Quote:
Originally Posted by clivew
So what were the values? - Exactly


You mean in the ini file, right?

If so, you can see it in my first post.

Reply With Quote
  #6  
Old June 24th, 2009, 04:42 PM
clivew clivew is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2006
Location: Carlsbad, CA
Posts: 1,124 clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level)clivew User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 6 Days 1 h 39 m 23 sec
Reputation Power: 272
Quote:
You mean in the ini file, right?

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

Reply With Quote
  #7  
Old June 25th, 2009, 12:39 PM
jeffijoe jeffijoe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 50 jeffijoe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 15 m 39 sec
Reputation Power: 1
Quote:
Originally Posted by clivew
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



I forgot the backslash, thanks xD

Reply With Quote
  #8  
Old June 26th, 2009, 10:23 AM
yb36007 yb36007 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Location: Saint Paul, MN
Posts: 2 yb36007 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 32 m 33 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > Ini File


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
Stay green...Green IT