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

Vista & Win7 Apps With Delphi 7

Status
Not open for further replies.

TBaz

Technical User
Jun 6, 2000
65
ES
I was recently asked to install an old app I wrote in Delphi 5 a few years ago, so I dug out my install CD.

Unfortunately, it wouldn't install on either of the two machines they had - one running Vista and the other Windows 7.

The Vista machine ran the installer OK and installed the program, but it wouldn't run. The Windows 7 machine refused to even run the installer.

What is strange is that I installed this program on a couple of Vista and Win7 machines a while back - without any problems. But, as they worked, I don't remember what versions of the OS they were - more than likely not 64bit...

My development platform now is Delphi 7 running under Windows XP Pro 32bit with SP3.

Is it possible to compile 32bit apps which will install and run in Windows XP, Vista and Win7?

I have the Delphi 5 source and can re-compile with Delphi 7, (though it would probably be a pain). What I don't want is to use a later version of Delphi. (I'm not a professional programmer and I'm comfortable with Delphi 7).

I'd rather tell them it just doesn't run on the version of Windows they have.

So, I hoped that someone here can save me a few hours of experimentation and messing about by telling me now if it can't be done.

I appreciate that I need to be running Delphi in a 64bit environment to create 64bit apps, but 32bit apps should run under Windows 7 in 32bit mode right?

The program used a couple of DLLs. Would they still work in Win7 x64 or would they cause problems?

Any pointers would be appreciated.

TBaz
 
Actually it can be done. Vista and 7 apply a number of rules which XP doesn't. The rules were mainly "suggestions" in XP, but were made mandatory in Vista and 7. These mainly have to do with where you put files, what parts of the registry you can handle, and so on.

You might give some details on what this program does. Perhaps someone can point out what you are doing wrong when it comes to Vista and 7.

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
 
I appreciate that I need to be running Delphi in a 64bit environment to create 64bit apps, but 32bit apps should run under Windows 7 in 32bit mode right?

I am confident that is not the case. Vista and Winderz 7 both support the Win32 API. Delphi 7 and every version of Delphi and C++ Builder since then are only for Win32 and only create Win32 applications, which Vista and Win7 still support. I use 2009 for Win32 development in a 64-bit Win7 Ultimate environment with no trouble.

Eventually CodeGear based development tools will generate 64-bit apps.

As Glenn9999 was saying there are new rules that are strictly enforced - no matter what the user setting level is. For example, The User Authorization Control (UAC) does not allow an executable to modify any file in the C:\Program Files or C:\Program Files (x86) directories.

Steve.
 
As has been said it's mostly down to registry writes, some areas that were commonly used up to XP are now forbidden in Vista/7, also watch out for third party components that write to the protected registry areas by default.

Steve: N.M.N.F.
If something is popular, it must be wrong: Mark Twain
 
Thanks for the input.

A bit more info based on the points raised:

The installer wouldn't run in Windows 7 - it just said it wasn't compatible with the version of Windows installed. No option to ignore and continue - just quit.

It was created with the version of InstallShield which came with Delphi 5. It ran fine on Vista though.

I was aware of the 'Program Files' permissions issue so during the Vista install, I chose a folder in C:\ to install to.

It's a multi-media app which essentially plays MP3 files from playlists but on the Vista machine, it dies when it first runs - before any music ever gets played.

It uses a shed-load of third party components so I have to admit that one of those might be trying to access a restricted section of the registry. My code does not access the registry at all.

I think I'm going to have to simply try and get it running in Delphi 7, compile it and try it again in Windows 7.

I just wondered if there were any special settings required in the compiler options to give it the best chance of working.

TBaz
 
The installer wouldn't run in Windows 7 - it just said it wasn't compatible with the version of Windows installed. No option to ignore and continue - just quit.

This may very well be true. If so, it's a problem with the installer code and not your code. If you want to test your program's compatibility, I would just try to load the exe onto the system and see what happens. InstallShield is old though (especially what was packaged with Delphi back in those days), so you might do well to try Inno Setup, NSIS or some other more modern installer system.

I was aware of the 'Program Files' permissions issue so during the Vista install, I chose a folder in C:\ to install to.

This wouldn't be a complete guarantee. It might be trying to write something to C:\Windows\* or C:\Program Files\*, which can be a config file or other things.

It uses a shed-load of third party components so I have to admit that one of those might be trying to access a restricted section of the registry. My code does not access the registry at all.

Like was mentioned, the biggest issues between XP and Vista in transition seem to be:
1) Doing something that requires an elevation of privileges or rights. This can be a number of things.
2) Doing something that was supported in XP that is no longer supported in Vista. HLP files are a good example of this.
3) Putting files/modifying files in places that they don't belong. Think any "system" directories.
4) Accessing public portions of the registry. Generally put, I understand the HKCU root is the only "free" access for any program.

It seems it would be good to research what your third-party components do as a next step. Good practice would dictate that you have source of them somewhere so you can research this, so hopefully you can either study this or find good replacements.

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
 
Agree with Glenn, Inno Setup seems to be keeping on top of the changes in Vista/7, I would recomend it as as an installer of choice (and its free).

Also I would recomend moving your development enviroment to at least Vista, that way you can see whats happening.

I havnt had any problems running any of my apps under Win7(64 bit), but then none of the ones I have tried do anything fancy.





Steve: N.M.N.F.
If something is popular, it must be wrong: Mark Twain
 
I too have had these issues, and was about to comment something I found out, but I see it was already mentioned above. Traditionally, you could open the registry like:

Code:
  Reg:= TRegistry.Create;

Now, you have to do this:

Code:
  Reg:= TRegistry.Create(KEY_READ or KEY_WRITE);

or like:

Code:
  Reg:= TRegistry.Create(KEY_ALL_ACCESS);

A program which opens, flashes really quick and then immediately terminates, is a good example of improper registry access on newer versions of Window.


JD Solutions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top