Please e-mail only..
Dave
dro...@inet911.com
And here is some sample code I found in the MSDN. To test for SP3 you may
have to check build numbers
#include <windows.h>
void main()
{
DWORD dwVersion;
char szVersion[80];
dwVersion = GetVersion();
if (dwVersion < 0x80000000) {
// Windows NT
wsprintf (szVersion, "Microsoft Windows NT %u.%u (Build: %u)",
(DWORD)(LOBYTE(LOWORD(dwVersion))),
(DWORD)(HIBYTE(LOWORD(dwVersion))),
(DWORD)(HIWORD(dwVersion)));
}
else if (LOBYTE(LOWORD(dwVersion))<4) {
// Win32s
wsprintf (szVersion, "Microsoft Win32s %u.%u (Build: %u)",
(DWORD)(LOBYTE(LOWORD(dwVersion))),
(DWORD)(HIBYTE(LOWORD(dwVersion))),
(DWORD)(HIWORD(dwVersion) & ~0x8000));
} else {
// Windows 95
wsprintf (szVersion, "Microsoft Windows 95 %u.%u (Build: %u)",
(DWORD)(LOBYTE(LOWORD(dwVersion))),
(DWORD)(HIBYTE(LOWORD(dwVersion))),
(DWORD)(HIWORD(dwVersion) & ~0x8000));
}
MessageBox( NULL, szVersion, "Version Check", MB_OK );
}
Dave Roscoe wrote in message <655cg6$g7q$1...@newsfep4.sprintmail.com>...
end
> How can I determine which operting system I am running on (Win 95 or NT4.0)
> Also, how can I check to see if Service Pack 3 is installed?
Call GetVersionEx(). To check for service packs, you'll have to parse
the szCSDVersion string -- it looks like "Service Pack %d", if an SP
is installed.
Cheers,
Felix.
--
If you post a reply, kindly refrain from emailing it, too.
------=_NextPart_000_0048_01BCF720.881D5890
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Dave Roscoe wrote in message <655cg6$g7q$1...@newsfep4.sprintmail.com>...
>
>How can I determine which operting system I am running on (Win 95 or =
NT4.0)
>Also, how can I check to see if Service Pack 3 is installed?
>
[clip]
Try the following:
-------------------------------------------------------------------------=
-------#define WIN32_LEAN_AND_MEAN#include <windows.h>
#include <stdio.h>
BOOL __x_getversionstring ( LPSTR Buffer, ULONG BufferSize ) { =
OSVERSIONINFO osv; CHAR SystemName[64];
osv.dwOSVersionInfoSize =3D sizeof(OSVERSIONINFO); if( =
!GetVersionEx(&osv)) { return FALSE; }
switch(osv.dwPlatformId) { case VER_PLATFORM_WIN32s: =
strcpy(SystemName,"Win32s"); break;
case VER_PLATFORM_WIN32_WINDOWS: =
strcpy(SystemName,"Windows"); break;
case VER_PLATFORM_WIN32_NT: =
strcpy(SystemName,"Windows NT"); break;
default: =
sprintf(SystemName,"[Unknown:%x]",osv.dwPlatformId); break; =
}
/** * For some reason, Win95 has everything encoded in the * =
dwBuildNumber field. So, for Win95 ONLY: * * =
HIBYTE(HIWORD(osv.dwBuildNumber) -> Major Version * =
LOBYTE(HIWORD(osv.dwBuildNumber) -> Minor Version * *** =
LOWORD(osv.dwBuildNumber) -> Build Number * * The =
dwMajorVersion and dwMinorVersion fields in the structure * are =
correct for Win95, so the only reason for the contortions * is to =
get the correct Build Number. * * The szCSDVersion field =
contains miscellaneous information * such as Service Pack =
applications. * */ _snprintf( Buffer, BufferSize, "%s Version =
%u.%u (Build: %u)", SystemName, osv.dwMajorVersion, =
osv.dwMinorVersion, (osv.dwPlatformId =3D=3D =
VER_PLATFORM_WIN32_WINDOWS)? =
LOWORD(osv.dwBuildNumber):osv.dwBuildNumber );
if( strlen(osv.szCSDVersion) > 0 ) { =
_snprintf(Buffer,BufferSize,"%s %s",Buffer,osv.szCSDVersion); }
return TRUE; }
int main ( int argc, char *argv[] ) { CHAR Buffer[MAX_PATH];
if( __x_getversionstring(Buffer,sizeof(Buffer))) { =
printf("Version: %s\n",Buffer); } else { =
printf("Error:%x\n",GetLastError()); }
return ERROR_SUCCESS; =
}------------------------------------------------------------------------=
--------
regards,
bill.
Bill Potvin, II
bpo...@merxsoft.com
http://www.merxsoft.com
------=_NextPart_000_0048_01BCF720.881D5890
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>
<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.71.1712.3"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>Dave Roscoe<DRO...@INET911.COM> wrote in message <<A=20
href=3D"mailto:655cg6$g7q$1...@newsfep4.sprintmail.com">655cg6$g7q$1@newsfep=
4.sprintmail.com</A>>...</DIV>
<DIV>> </DIV>
<DIV>>How can I determine which operting system I am running on (Win =
95 or=20
NT4.0)<BR>>Also, how can I check to see if Service Pack 3 is=20
installed?<BR>><BR>[clip] </DIV>
<DIV> </DIV>
<DIV>Try the following:</DIV><PRE><FONT color=3D#0000ff face=3D"" =
size=3D2><HR>#define WIN32_LEAN_AND_MEAN<BR>#include =
<windows.h></FONT> </PRE><PRE><FONT color=3D#0000ff face=3D"" =
size=3D2>#include <stdio.h></FONT></PRE><PRE><FONT color=3D#0000ff =
face=3D"" size=3D2><BR>BOOL __x_getversionstring (<BR> LPSTR Buffer,<BR> =
ULONG BufferSize )<BR> {<BR> =
OSVERSIONINFO osv;<BR> CHAR =
SystemName[64];</FONT> </PRE><PRE><FONT color=3D#0000ff face=3D"" =
size=3D2> osv.dwOSVersionInfoSize =3D =
sizeof(OSVERSIONINFO);<BR> if( =
!GetVersionEx(&osv))<BR> =
{<BR> return =
FALSE;<BR> =
}</FONT> </PRE><PRE><FONT color=3D#0000ff face=3D"" =
size=3D2> =
switch(osv.dwPlatformId)<BR> =
{<BR> case =
VER_PLATFORM_WIN32s:<BR> &=
nbsp; =
strcpy(SystemName,"Win32s");<BR> &=
nbsp; break;</FONT> </PRE><PRE><FONT =
color=3D#0000ff face=3D"" =
size=3D2> case =
VER_PLATFORM_WIN32_WINDOWS:<BR> =
=
strcpy(SystemName,"Windows");<BR> =
break;</FONT> </PRE><PRE><FONT =
color=3D#0000ff face=3D"" =
size=3D2> case =
VER_PLATFORM_WIN32_NT:<BR>  =
; strcpy(SystemName,"Windows =
NT");<BR>  =
; break;</FONT> </PRE><PRE><FONT color=3D#0000ff face=3D"" =
size=3D2> =
default:<BR> &=
nbsp; =
sprintf(SystemName,"[Unknown:%x]",osv.dwPlatformId);<BR> &=
nbsp; =
break;<BR> =
}</FONT> </PRE><PRE><FONT color=3D#0000ff face=3D"" =
size=3D2> /**<BR> * For some =
reason, Win95 has everything encoded in the<BR> =
* dwBuildNumber field. So, for Win95 =
ONLY:<BR> *<BR> * =
HIBYTE(HIWORD(osv.dwBuildNumber) -> Major =
Version<BR> * LOBYTE(HIWORD(osv.dwBuildNumber) =
-> Minor Version<BR> * *** =
LOWORD(osv.dwBuildNumber) -> Build =
Number<BR> *<BR> * The =
dwMajorVersion and dwMinorVersion fields in the =
structure<BR> * are correct for Win95, so the =
only reason for the contortions<BR> * is to get =
the correct Build Number.<BR> =
*<BR> * The szCSDVersion field contains =
miscellaneous information<BR> * such as Service =
Pack applications.<BR> =
*<BR> */<BR> _snprintf( =
Buffer, BufferSize, "%s Version %u.%u (Build: =
%u)",<BR> SystemName, osv.dwMajorVersion, =
osv.dwMinorVersion,<BR> (osv.dwPlatformId =3D=3D =
VER_PLATFORM_WIN32_WINDOWS)?<BR> =
LOWORD(osv.dwBuildNumber):osv.dwBuildNumber =
);</FONT> </PRE><PRE><FONT color=3D#0000ff face=3D"" =
size=3D2> if( strlen(osv.szCSDVersion) > 0 =
)<BR> =
{<BR> =
_snprintf(Buffer,BufferSize,"%s =
%s",Buffer,osv.szCSDVersion);<BR>  =
; }</FONT> </PRE><PRE><FONT color=3D#0000ff face=3D"" =
size=3D2> return TRUE;<BR> =
}</FONT> </PRE><PRE><FONT color=3D#0000ff face=3D"" =
size=3D2><BR>int main (<BR> int argc,<BR> char *argv[] =
)<BR> {<BR> CHAR =
Buffer[MAX_PATH];</FONT> </PRE><PRE><FONT color=3D#0000ff face=3D"" =
size=3D2> if( =
__x_getversionstring(Buffer,sizeof(Buffer)))<BR> &=
nbsp; {<BR> =
printf("Version: =
%s\n",Buffer);<BR> =
}<BR> =
else<BR> =
{<BR> =
printf("Error:%x\n",GetLastError());<BR>  =
; }</FONT> </PRE><PRE><FONT color=3D#0000ff =
face=3D"Lucida Console" size=3D2> return =
ERROR_SUCCESS;<BR> }</FONT><BR><HR></PRE>
<DIV><FONT color=3D#000000>regards,</FONT></DIV>
<DIV><FONT color=3D#000000>bill.</FONT></DIV>
<DIV><FONT color=3D#000000>Bill Potvin, II<BR><A=20
href=3D"mailto:bpo...@merxsoft.com">bpo...@merxsoft.com</A><BR><A=20
href=3D"http://www.merxsoft.com">http://www.merxsoft.com</A><BR></FONT>&n=
bsp;</DIV></BODY></HTML>
------=_NextPart_000_0048_01BCF720.881D5890--
Nico Cuppen
ncu...@pi.net
Dave Roscoe heeft geschreven in bericht
<655cg6$g7q$1...@newsfep4.sprintmail.com>...
>How can I determine which operting system I am running on (Win 95 or NT4.0)
>Also, how can I check to see if Service Pack 3 is installed?
>
-Dave