Tech Support Guy banner
Status
Not open for further replies.
1 - 6 of 6 Posts

· Registered
Joined
·
68 Posts
Discussion Starter · #1 ·
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!
 

· Registered
Joined
·
68 Posts
Discussion Starter · #2 ·
and plzzzzzzzzzzzzzzzzz... without using external class. :)
 

· Registered
Joined
·
68 Posts
Discussion Starter · #4 ·

· Registered
Joined
·
68 Posts
Discussion Starter · #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! )
 

· Registered
Joined
·
3,258 Posts
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-us/shellcc/platform/shell/reference/enums/csidl.asp?frame=true

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

-----
for winver info - see
http://msdn2.microsoft.com/en-gb/library/ms724429(d=printer).aspx
and
http://msdn2.microsoft.com/en-gb/library/ms724832(d=printer).aspx
http://msdn2.microsoft.com/en-gb/library/ms725492(d=printer).aspx
 
1 - 6 of 6 Posts
Status
Not open for further replies.
Top