More Windows OS information

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

More Windows OS information

Post by PB »

Problem: OSVersion() is great, but if you want to check for an NT-based system.
Currently: If OSVersion()<>#PB_OS_Windows_95 And OSVersion()<>#PB_OS_Windows_98 And OSVersion()<>#PB_OS_Windows_ME
Suggested: New command: IsNTFamily() ; Returns #True or #False.

Problem: Sometimes you just want to check for NT itself.
Currently: If OSVersion()=#PB_OS_Windows_NT3_51 Or OSVersion()=#PB_OS_Windows_NT_4
Suggested: New constant: #PB_OS_Windows_NT to cover both.

Problem: Knowing if the user is running Small Fonts or not is handy.
Currently: a=GetDesktopWindow_() : b=GetDC_(a) : c=97-GetDeviceCaps_(b,#LOGPIXELSX) : ReleaseDC_(a,b) ; c=1 for small fonts.
Suggested: New command: SmallFonts() ; Returns #True or #False.

Problem: Knowing if an XP machine is running XP or Classic style windows.
Currently: See Registry entry at viewtopic.php?t=19773
Suggested: New command: XPStyle() ; Returns #PB_OS_XPStyle_XP or #PB_OS_XPStyle_Classic.

And in addition to the XP one just above:
Problem: Knowing what color scehem an XP machine is running.
Currently: See Registry entry at viewtopic.php?t=19773
Suggested: New command: XPScheme() ; Returns #PB_OS_XPScheme_Blue, #PB_OS_XPScheme_Olive, #PB_OS_XPScheme_Silver, #PB_OS_XPScheme_Unknown.

And lastly, how about constants for common paths like these:

#WindowsDir$, #SystemDir$, #TempDir$, #MyDocsDir$, #DesktopDir$, #StartupDir$, #ProgramFilesDir$ ... would make things a lot easier than:

windir$=Space(999) : GetWindowsDirectory_(@windir$,999)
sysdir$=Space(999) : GetSystemDirectory_(@sysdir$,999)
tmpdir$=Space(999) : GetTempPath_(999,tmpdir$)
progfile$=RegReadString(#HKEY_LOCAL_MACHINE,"Software\Microsoft\Windows\CurrentVersion","ProgramFilesDir")
desktop$=RegReadString(#HKEY_CURRENT_USER,"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Desktop")
mydoc$=RegReadString(#HKEY_CURRENT_USER,"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Personal")
startup$=RegReadString(#HKEY_CURRENT_USER,"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Startup")

And maybe a command to add a backslash to a path if not already there:
a$=Space(999) : GetWindowsDirectory_(@a$,999) : windir$=HasBackSlash(a$)

Please consider them; they're all so easy to add and very handy. :)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

maybe this builtin set of commands might be enough for some of your requests ?

Code: Select all

Debug GetEnvironmentVariable("WINDIR")
Debug GetEnvironmentVariable("SYSTEMROOT")
Debug GetEnvironmentVariable("TEMP")
Debug GetEnvironmentVariable("USERPROFILE")
Debug GetEnvironmentVariable("OS")

If ExamineEnvironmentVariables()
  While NextEnvironmentVariable()
    Debug EnvironmentVariableName()
  Wend
EndIf
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Post Reply