Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to know Nt/win95-98 programatically?

Posted on 2000-05-09
7
Medium Priority
?
175 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
[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
 

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 31

Accepted Solution

by:
Zoppo earned 800 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 31

Expert Comment

by:Zoppo
ID: 2792561
hmm, too late      :(
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

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.
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…

719 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