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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inifile ReadString in XE4

Status
Not open for further replies.

topcat01

Programmer
Jul 10, 2003
83
GB
Hi,

I am moving a project from Delphi 7 to XE4 and compilation appeared fine. I have XE4 installed on Windows 7 and building as a Win32 application, the program appears to work fine on that machine and no issues (I have Delphi 7 on a Vista machine.)

When I copy the program to Vista I get problems. The startup of the program is supposed to read an ini file, gets the filepath of a logo and displays on screen, this simply does not work and no custom logo is displayed. This works fine on XE4/Win7 but on Vista no luck. When I changed to XE4 I did change all AnsiString to String in the code, but since the issue is at the start of execution not much is stored into variables I declared so not sure if that would cause issue.

This is my basic code which compiles without issue in both XE4 and D7 but will not display in Vista if built in Win7/XE4:

Code:
Var
Gbl_logo : string;

Inifile:=tinifile.create(extractfilepath(application.exename)+’settings.ini’;
Gbl_logo := inifile.readstring(‘Settings’,’Logo’,’’);
If trim(Gbl_logo) <> ‘’ then
Begin
  If FileExists(Gbl_logo) then
  Begin
    Imglogo.picture.loadfromfile(gbl_logo);
  end;
End;

Example paths of my logo are d:\custom.jpg and c:\programming picture\test.jpg.

Thank you in advance to any suggestions.

 
Just to add when I do showmessage the dialog box in Win7 shows for example:

c:\projects\software example logo code\logo.jpg

When run in Vista I get:

c:\projects\software example logo
code\logo.jpg

It looks like a line break appears from nowhere, I checked the ini file and no line breaks...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top