Congratulations to AcaCandy on her 100,000th post!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot bsod computer connection crash css dell display drive driver drivers email error ethernet excel firefox firefox 3 game hard drive internet internet explorer itunes laptop linux malware monitor network networking nvidia outlook outlook 2003 outlook 2007 outlook express partition problem router slow software sound trojan usb video virus vista windows windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Get the windows version & directory using C++ ??


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
AZPC's Avatar
Member with 68 posts.
 
Join Date: Dec 2006
Experience: Advanced
24-Dec-2006, 02:44 PM #1
Get the windows version & directory using C++ ??
Hi everybody

How can I get what version of windows the machine is running ( 95 98 2000 XP .. ? )
and how can I find its directory ( C:\WINNT , C:\WINDOWS , X:\WINNT .... )

using C++


Thanks in Advance!
AZPC's Avatar
Member with 68 posts.
 
Join Date: Dec 2006
Experience: Advanced
24-Dec-2006, 02:52 PM #2
and plzzzzzzzzzzzzzzzzz... without using external class.
Chicon's Avatar
Computer Specs
Distinguished Member with 6,673 posts.
 
Join Date: Jul 2004
Location: 50° 34' 07.13" N - 04° 10' 23.
Experience: Second socks retriever
24-Dec-2006, 03:03 PM #3
Hi AZPC,

There is an example on the following page :

http://msdn2.microsoft.com/en-us/lib...9s(VS.80).aspx

AZPC's Avatar
Member with 68 posts.
 
Join Date: Dec 2006
Experience: Advanced
24-Dec-2006, 04:19 PM #4
Quote:
Originally Posted by Chicon
Hi AZPC,

There is an example on the following page :

http://msdn2.microsoft.com/en-us/lib...9s(VS.80).aspx

WoW

Thanks dude!!!!!!!!!!!!


but it didn't work with Borland C++ no idea why ! -- maybe because it is .NET C++

anyway I need the other thing it is more important!

I couldn't use %windir%
AZPC's Avatar
Member with 68 posts.
 
Join Date: Dec 2006
Experience: Advanced
24-Dec-2006, 04:26 PM #5
I found it !!!!!!!!!!!!!!!!!!!!
Code:
TCHAR OSDir[MAX_PATH];

GetWindowsDirectory (OSDir,MAX_PATH);
::MessageBox (NULL,OSDir,"1",MB_OK);
Cool . . .

now how to get the version without the .Net stuff ( I really hate it! )
IMM's Avatar
IMM IMM is offline IMM is authorized to help remove malware.
Distinguished Member with 3,160 posts.
 
Join Date: Feb 2002
24-Dec-2006, 06:45 PM #6
The following sort of thing would work using the CSIDL_WINDOWS (0x0024) value if borland provides the required include (shlobj.h)
If not, you would likely need to use one of the PSDKs with your BC for the shell method.
Code:
int GetSpecialDir(int dir_csidl, char *buf) {
  int status;
  
  if (!strlen(buf))
    status = SHGetSpecialFolderPathA(NULL, buf, dir_csidl, 0);
  return status;
}

//called as
status = GetSpecialDir(CSIDL_WINDOWS, (LPSTR)&cDirName);
values can be found at
http://msdn.microsoft.com/library/en...asp?frame=true

Alternatively, you could read it from the registry, or ...
Lot's of ways to skin that cat

-----
for winver info - see
http://msdn2.microsoft.com/en-gb/lib...=printer).aspx
and
http://msdn2.microsoft.com/en-gb/lib...=printer).aspx
http://msdn2.microsoft.com/en-gb/lib...=printer).aspx

Last edited by IMM : 24-Dec-2006 07:08 PM.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 04:03 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.