Solved

How to know Nt/win95-98 programatically?

Posted on 2000-05-09
7
163 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 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 31

Expert Comment

by:Zoppo
ID: 2792561
hmm, too late      :(
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
difference between String.subString() and String.subSequence() 6 289
wordcount challenge 11 163
x-bar in Google Sheets 2 129
Message not shown 5 104
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

734 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