Delphi 2009 Handbook




Delphi 2007 Handbook




Essential Pascal




social web book








October 2, 2009

Old Delphi Applications More Compatible with Windows 7

I've noticed that Windows 7 is more compatible with old Delphi applications than Vista. Here are two cases I found.

I've noticed that Windows 7 is more compatible with old Delphi applications than Vista. Here are two cases I found (mostly while giving my talk on Windows 7 at EKON last Tuesday).

The first relates with the preview of the application main form available in Windows Flip (the task bar preview), Windows Flip 3D, or even the plain list of windows you obtain using Alt+Tab keys. In Vista, a traditional Delphi application would have been represented by its icon when it was minimized and displayed in any of these views. The fix came to the VCL in Delphi 2007 with the MainFormOnTaskbar property of the TApplication class. In Windows 7, however, a traditional Delphi application would show properly in the various previews, even when minimized. This basically means that the MainFormOnTaskbar property becomes much less relevant, although it will still affect the title displayed for the application in the taskbar. With older versions of Delphi, or in case the property is set to False, the title will match the Title property of the Application global object; on the other hand, if MainFormOnTaskbar is set to True, the title is the Caption of the main form.

Another relevant change relates to the behavior of Windows Resource Protection and Virtual Storage (the area created for each user to host the document and configuration files that old “non-themed” applications save in Program Files sub-folders or in the Windows folder). Windows 7 expands the virtual storage area to include the root of the C: drive. As an example, the FileAccess program discussed in my “Delphi 2007 Handbook” tried to save a file to the root of the C: drive with the code: "Memo1.Lines.SaveToFile ('C:\SomeText.txt');". In Vista this code used to fail with an error both for a themed and a non-themed application, in Windows 7 the themed application succeeds and saves the file to the basic folder of the virtual storage area, which on my computer (for my account) is: C:\Users\Marco\AppData\Local\VirtualStore.

So, with all fanfare saying you have to move to .NET to build Windows applications, Microsoft is putting extra effort to let old Delphi (and I suspect, Visual Basic 6) programs work better with the latest version of their operating system. Maybe I missed other extended compatibilities (or incompatibilties) between Delphi programs and Vista, fell free to share others on the blog or email me.

PS. Delphi 2010 offers native support for a number of interesting new features of Windows 7, covered in my talk and part of my coming "Delphi 2010 Handbook". These are all native or COM libraries, so no .NET required either. But that's a different story.





 

4 Comments

Old Delphi Applications More Compatible with Windows 7 

 A lot of old delphi application compatibilty or 
incompatibility comes down to HOW the app designer 
wrote the code.    For example, I have a lot of older 
apps from my Delphi7 era that write configuration 
information (ini files etc) to "C:\Program Files".

These will work I think on vista if you're an 
administrator and fail if you aren't, and I think 
that on Win7 by default not even administrators have 
write permission to Program Files unless they have a 
rights elevation granted such as could be done for 
installers.

W
Comment by Warren on October 2, 19:31

Old Delphi Applications More Compatible with Windows 7 

"document and configuration files that old “non-
themed” applications"
I didn't understand the "themed" meaning. Since 
Windows 2000 - which had no theme - applications 
should have stored their files outside program files 
and system directories which became read-only for non-
privileged users. "Document and settings" has been 
available since then.
The fact that too many developers ignored it and 
didn't cause troubles just shows how many users 
accessed their systems with too elevate privileges.
Frankly, I would have preferred Vista and 7 to block 
those applications wholly, instead of employing those 
tricks that sometimes can lead to some strange 
effects.
Comment by Luigi D. Sandon [http://www.sandon.it] on October 2, 21:48

Old Delphi Applications More Compatible with Windows 7 

"... in Windows 7 the themed application succeeds and
saves the file to the basic folder of the virtual
storage area, ..."
Really? >Themed< apps can save files into secured
folders which are then redirected? Shouldn't that be
the unthemed old apps?
Comment by Christian Wimmer [http://blog.delphi-jedi.net] on October 2, 22:39

Old Delphi Applications More Compatible with Windows 7 

I didn't test Windows 7, but it cannot be less
compatible than Vista. Vista broke more applications
than any other Windows release. That made users very
unhappy (to say the least).

If Windows 7 is to succeed, it must be friendly to old
apps. Otherwise people will start looking elsewhere...
That would reduce the value of MS considerably..
Comment by Omar on October 16, 00:11


Post Your Comment

Click here for posting your feedback to this blog.

There are currently 0 pending (unapproved) messages.