Sunday, October 4, 2009

Old Delphi Applications More Compatible with Windows 7 -Marco Cantu - 2nd Oct 2009

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

I've noticed that Windows 7 is more compatible with old Delphi applications than Vista is. 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 views1. 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 changes relates with the behavior of Windows Resource Protection and the 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: drive2. 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.

Marco Cantu
2nd October 2009

1 comment:

Kofi said...

Hi,

I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading.

Nice blog. I will keep visiting this blog very often.

-
Delphi development

Welcome to Delphi... Delphi... Delphi

I have been a Delphi Developer since Delphi 3 when I finally decided on Delphi in 1996 as my programming language of choice for the Windows 32 environment. So what have I created with Delphi ?

Would you believe that I had single-handedly created a full ERP2 system comprising ERP+CRM where ERP=Sales Distribution+MRP+ Procurement Management+Planning & Production +Finacial Management + Human Resources Management System.

Since 15th February 2009, we have visitors from more than 60 countries including Malaysia, United States, Brazil, Italy, Australia, India, Turkey, Russian Federation, Spain, Indonesia, Hungary, South Africa, Germany, Mexico, Argentina, Singapore, Saudi Arabia, Colombia, Czech Republic, Canada, France, Croatia,Thailand, Bulgaria, Slovenia, Hong Kong, Poland, Sri Lanka, Chile, Japan, Austria, Ukraine, Azerbaijan, Ireland, Tunisia, Greece, Taiwan, Egypt, Bolivia, Paraguay, Iran, Islamic Republic , Morocco, Angola, Belgium, Portugal, Norway, Venezuela, United Arab Emirates, Algeria, Korea, Republic Of, Slovakia, Georgia, Lebanon, Macedonia, Sweden, Philippines, Vietnam, Dominican Republic