Delphi fix for Windows 7 issue

Recently had a problem with an application written in Delphi running on Windows 7. I noticed the problem when running a query which was returning an invalid timestamp error. The software worked fine on XP it was just on Windows 7. The regional settings for the date and time on the PC’s where correct and I could not understand why the problem was occuring. However the fix I found was to put the following bit of code in the project dpr.

SetThreadLocale(LOCALE_USER_DEFAULT);
GetFormatSettings;

This will require SysUtils to be added into the uses clause.

Leave a Reply

You must be logged in to post a comment.