Solved

How to know Nt/win95-98 programatically?

Posted on 2000-05-09
7
148 Views
Last Modified: 2013-11-20
Hello,
    For my application, i am creating two exes separately for win 95/98 and windowsNT since i need to execute some part of the code depending on the OS. Is there any macro to know whether the machine is running NT or windows 95/98., so that i can have single exe for both.
  I would be thankful if anybody can help me out in this case.

regards,
sunil
0
Comment
Question by:sunil_vee
7 Comments
 

Expert Comment

by:pkkn
ID: 2792530
Hai Sunil,

Try It.
define the following


#define  IS_NT (BOOL)(GetVersion() < 0x80000000)&& (LOBYTE(LOWORD
(GetVersion())) <= 4)

#define     IS_WIN95      (BOOL)(!(IS_NT) && ((DWORD)(HIBYTE(LOWORD(GetVersion())))==0)

#define     IS_WIN98      (BOOL)(!(IS_NT) && ((DWORD)(HIBYTE(LOWORD(GetVersion())))>0)

And check the value,

if(IS_NT)
{
//OS is Win NT
}

if(IS_WIN98)
{
//OS is WIN95
}


if(IS_WIN95)
{
//OS is WIN98
}

0
 
LVL 30

Accepted Solution

by:
Zoppo earned 200 total points
ID: 2792553
Hi sunil_vee,

try this:


....
OSVERSIONINFO      os;
os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&os);
switch( os.dwPlatformId )
{
 case( VER_PLATFORM_WIN32s ):
  // do what you want when Win3.1 with Win32s is running...
  break;
 case( VER_PLATFORM_WIN32_WINDOWS ):
  // do what you want when Win95/98 is running...
  break;
 case( VER_PLATFORM_WIN32_NT ):
  // do what you want when WinNT/2000 is running...
  break;
}
....

hope that helps,

ZOPPO
0
 
LVL 30

Expert Comment

by:Zoppo
ID: 2792561
hmm, too late      :(
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 23

Expert Comment

by:chensu
ID: 2794957
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 2795017
PJ Naughter has the best solution I've seen. And it's free, handles Win2000 etc

get it from his web site.

http://www.naughter.com/dtwinver.html

From that page description:

>>>>
DtWinVer is a routine which provides a comprehensive method to determine which OS the program that calls it is running on. All methods it uses are fully documented on various articles on the MSDN CD. The routine provides the emulated OS aswell as the underlying OS. e.g. to a Dos program Windows 95 looks like MS-DOS 7.0. A full list of the OS’s it can detect are:

Dos
Windows 3.0
Windows 3.1
Windows 3.11
Windows for Workgroups
Win32s (if you can call this an OS <g>)
Windows CE 1.0  
Windows CE 2.0
Windows CE 2.1
Windows CE 2.11
Windows CE 3.0
Windows 95
Windows 95 Service Pack 1
Windows 95 OEM Service Release 2
Windows 98
Windows 98 Service Pack 1
Windows 98 Second Edition
NT Workstation, Server 3.1
NT Workstation, Server, PDC, BDC 3.5
NT Workstation, Server, PDC, BDC 3.51
NT Workstation, Server, PDC, BDC 4.0
Windows 2000 Professional
Windows 2000 Server / Advanced Server
Windows NT Terminal Server
Windows NT Enterprise Edition
Some of the possible scenarios it can report on are:

"You are running an emulated Dos v5.50 On NT"
"You are running an emulated Windows 3.95 on Windows 95 v4.0 Build 950"
"You are running Windows for Workgroups on Dos v6.22"
"You are running NT Server v3.51"
 

Have you ever wanted to determine if you are running under Windows 95 or NT from a 16 bit app. Here's the answer, this routine can return such information as:

"You are running an emulated Dos v5.50 On NT"
"You are running an emulated Windows 3.95 on Windows 95 v4.0 Build 950"
"You are running Windows for Workgroups on Dos v6.22"
"You are running NT Server v3.51"
"You are running an application on Windows NT Terminal Server.
This NT machine is acting as a stand alone server, primary domain controller or backup domain controller.

>>>

0
 

Author Comment

by:sunil_vee
ID: 2813133
Answer not satisfactory. I want to consider Zoppo's comment as the answer
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 2813414
What is not satifactory about it?  It gives you all the info about what OS you are running on.  And is quite easy to use.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now