[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Need help detecting the operating system

Posted on 1998-01-13
7
Medium Priority
?
143 Views
Last Modified: 2010-04-04
I need some help to detect whether the OS is Windows95 or Windows NT (which version doesn't matter)

Thanks in Advance,
Ermac


0
Comment
Question by:ermac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 2

Expert Comment

by:mvz121697
ID: 1356378
uses
  WinProcs, SysUtils, Dialogs;

var
  Version: record
             case Boolean of
              False: (
                     Windows: record
                                 major: Byte;
                                 minor: Byte;
                               end;
                     DOS: record
                            minor: Byte;
                            major: Byte;
                          end;
                     );
              True: (GetVersion: LongInt);
            end {Version};

begin
  Version.GetVersion := GetVersion;
  if Version.Windows.major < 4 then
    ShowMessage(Format('DOS %d.%-d, Windows %d.%-d',
                       [Version.DOS.major,Version.DOS.minor,
                        Version.Windows.major,Version.Windows.minor]))
  else
    ShowMessage(Format('Windows 95/NT %d.%-d',
                       [Version.Windows.major,Version.Windows.minor]))
end.

When compiled with Delphi 1.02 and run on Windows 95, this program returns "DOS
7.0, Windows 3.95". When compiled with Delphi 2.01 and run on Windows
95, this program returns "Windows 95/NT 4.00", and so it should.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1356379
If you use Delphi 2/3 then you can use GetVersionEx:
procedure TForm1.Button1Click(Sender: TObject);
var
  FVer: TOSVERSIONINFO;
begin
  FVer.dwOSVersionInfoSize:=sizeof(TOSVERSIONINFO);
  GetVersionEx(FVer);
  if FVer.dwPlatformId=VER_PLATFORM_WIN32_WINDOWS then
    showmessage('Windows 95 version '+InttoStr(FVer.dwMajorVersion)+'.'+InttoStr(FVer.dwMinorVersion))
  else if FVer.dwPlatformId=VER_PLATFORM_WIN32_NT then
    showmessage('Windows NT version '+InttoStr(FVer.dwMajorVersion)+'.'+InttoStr(FVer.dwMinorVersion))
end;
0
 

Author Comment

by:ermac
ID: 1356380
ronit..

I think your solution is much cleaner...
So how do I give you the points??

Ermac
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 5

Expert Comment

by:ronit051397
ID: 1356381
I'll post some answer.
0
 
LVL 5

Accepted Solution

by:
ronit051397 earned 120 total points
ID: 1356382
Ok, I have posted...
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2815772
Bought this Q...
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 4536437
So did I
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question