Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the Windows version is Vista and up versus XP on Delphi?

Is there any way to know which verion of Windows we are working on?

I need to set image to TBitButton in Windows XP and no image in Windows7. It should be done automatically.

like image 874
Rakesh Devarasetti Avatar asked Feb 02 '26 15:02

Rakesh Devarasetti


1 Answers

Check the SysUtils.Win32MajorVersion (in Delphi 7, you'll need to add SysUtils to your uses clause if it's not there already - later versions add it automatically). The easiest way is to assign the Glyph as usual in the IDE, and clear it if you're running on Vista or higher:

if SysUtils.Win32MajorVersion >= 6 then // Windows Vista or higher
  BitBtn1.Glyph := nil;

For more info on detecting specific Windows editions and versions, see this post. It hasn't been updated for the latest Windows versions and editions, but it'll get you started. You can also search SO for [delphi] GetVersionEx to see other examples.

like image 157
Ken White Avatar answered Feb 05 '26 09:02

Ken White



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!