Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7988141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:21:02+00:00 2026-06-04T12:21:02+00:00

Possible Duplicate: How to detect true Windows version I have an application which uses

  • 0

Possible Duplicate:
How to detect true Windows version

I have an application which uses a third-party library(dll – no source code) which protect (encrypt) some customer data, this dll must be initializated using different params depending of the current Windows Version. If my app is executed in XP compatibility mode under Windows 7, the dll encrypt method fails. So i need a way to detect when My App is running under compatibility mode to prevent this issue. So How I can detect if my application is running under compatibility mode?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:21:04+00:00Added an answer on June 4, 2026 at 12:21 pm

    You can compare the value returned by the GetVersionEx function against the Version property of the Win32_OperatingSystem WMI class.

    Try this sample

    {$APPTYPE CONSOLE}
    
    {$R *.res}
    
    uses
      Windows,
      SysUtils,
      ActiveX,
      ComObj,
      Variants;
    
    function WMI_OSVersion:string;
    var
      FSWbemLocator : OLEVariant;
      FWMIService   : OLEVariant;
      FWbemObjectSet: OLEVariant;
      rgvar         : OLEVariant;
      LEnum         : IEnumVARIANT;
      pceltFetched  : LongWord;
    begin
      FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
      FWMIService   := FSWbemLocator.ConnectServer('localhost', 'root\CIMV2', '', '');
      FWbemObjectSet:= FWMIService.ExecQuery('SELECT Version FROM Win32_OperatingSystem','WQL', $00000020);
      LEnum         := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant;
      if LEnum.Next(1, rgvar, pceltFetched) = S_OK  then
       Result:=String(rgvar.Version);
    end;
    
    function WinApi_OsVersion:string;
    var
      lpVersionInformation: TOSVersionInfo;
    begin
      ZeroMemory(@lpVersionInformation, SizeOf(lpVersionInformation));
      lpVersionInformation.dwOSVersionInfoSize:=SizeOf(lpVersionInformation);
      GetVersionEx(lpVersionInformation);
      Result:=Format('%d.%d.%d',[lpVersionInformation.dwMajorVersion, lpVersionInformation.dwMinorVersion, lpVersionInformation.dwBuildNumber]);
    end;
    
    function RunningCompatibilityMode : Boolean;
    begin
       Result:=WMI_OSVersion<>WinApi_OsVersion;
    end;
    
    begin
     try
        CoInitialize(nil);
        try
          Writeln('Running in Compatibility Mode - '+ BoolToStr(RunningCompatibilityMode, True));
        finally
          CoUninitialize;
        end;
     except
        on E:EOleException do
            Writeln(Format('EOleException %s %x', [E.Message,E.ErrorCode]));
        on E:Exception do
            Writeln(E.Classname, ':', E.Message);
     end;
     Writeln('Press Enter to exit');
     Readln;
    end.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to detect if JavaScript is disabled? I have a website which
Possible Duplicate: How to detect which row [ tr ] is clicked? I have
Possible Duplicate: Best way to detect integer overflow in C/C++ i have tried to
Possible Duplicate: How to detect a click outside an element? I have a drop
Possible Duplicate: How to detect if a variable is an array I have a
Possible Duplicate: How to detect Windows 64 bit platform with .net? I'm using this
Possible Duplicate: Any php code to detect the browser with version and operating system?
Possible Duplicate: Detect element content changes with jQuery I have a wrapper div say
Possible Duplicate: Detect element content changes with jQuery I have a div with a
Possible Duplicate: How to detect Windows 64 bit platform with .net? At a low

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.