Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

TRegIniFile.Create('') fails in D6

Posted on 2002-07-04
10
Medium Priority
?
328 Views
Last Modified: 2010-04-04
I often used TRegIniFile and declared
var
  RegItem: TRegIniFile;

and did
  RegItem := TRegIniFile.Create('');

Which fails in D6.

I've got round it by using TRegistry and declared
var
  RegItem: TRegistry;

and doing
  RegItem := TRegistry.Create;

But TRegIniFile.Create('') always worked OK in D5 and below as far as I remember. Just tested and still works OK in D5 on same system.

Is this a D6 bug or was I doing something wrong until D6 stopped me?

I have Delphi 6 sp2 installed and running on winxp.
I searched but have not found anything relevant so far.

Anyone know what is going on here?

Regards
Steve


0
Comment
Question by:SteveWaite
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
  • 2
10 Comments
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 7130652
Hello Steve

>> Which fails in D6.

what do u mean by that?, it's working fine with me in Delphi 6 and win XP, r u sure that u add Registry to the uses clause?
and what's the error message you got?

aslo why u don't use TRegistry instead of it?



0
 
LVL 3

Author Comment

by:SteveWaite
ID: 7130665
Hi Mohammed,

Thanks,

Registry is added to uses clause ;-), but I did say I just run the whole thing in D5 and worked fine!

I do use TRegistry but found this from a section that writes .ini files as well.

No error message, just silently leaves the procedure on the line

  RegItem := TRegIniFile.Create('');

Are you sure you do the same thing, declare a file of no name?

Regards
Steve
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 7130739
yes
i just copy what u wrote exactly and it worked fine without any errors
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Author Comment

by:SteveWaite
ID: 7130795
Strange?!

I have D6 pro
0
 
LVL 3

Author Comment

by:SteveWaite
ID: 7130850
Now in unit Registry..

function IsRelative(const Value: string): Boolean;
begin
  Result := not ((Value <> '') and (Value[1] = '\'));
end;

IsRelative() fails at Value[1] because Value = ''

So I went to 'complete boolean eval' and needed unchecking so that ((Value <> '') prevents the computation of (Value[1] = '\').

This still works ok in D5!! the 'complete boolean eval' setting makes no difference to IsRelative().

So now I ask the same question but a different way:

Why with D6 must we have 'complete boolean eval' unchecked for code in the Registry to work when it was fine in D5 checked or not? What is is causing this?



0
 
LVL 8

Expert Comment

by:TOndrej
ID: 7131057
Not to use complete Boolean evaluation is the default.
In D5, you're probably using the .dcu supplied by Borland which was compiled with {$B-}.
In D6, you're probably compiling your own new .dcu.
0
 
LVL 3

Author Comment

by:SteveWaite
ID: 7131905
Thanks TOndrej,

Exactly! Now why, all of a sudden, am i compiling my own .dcu?
0
 
LVL 8

Accepted Solution

by:
TOndrej earned 400 total points
ID: 7131948
Because the .dcu file is not found or the .pas file is found sooner.
Check your paths.
The .pas directory probably appears in your library path before the .dcu directory; or maybe the .dcu directory is missing in your library path.

IMO you should not have the .pas directory included in your library path at all; remove it if it's there.
The same applies to your Project Options search path.
0
 
LVL 3

Author Comment

by:SteveWaite
ID: 7131975
ok, having a look, back soon.
0
 
LVL 3

Author Comment

by:SteveWaite
ID: 7131988
Woah! The .pas dir was slipped in there but hey, it wasn't me!

Thanks TOndrej, you have it this time, Mohammed thanks for your time too.

Regards
Steve
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question