getWindowsAPIVendor

This little code snippet's aim is to provide you with a way of knowing whether your platform is Microsoft Windows, Wine or ReactOS.

Most of the time, you may not care. Wine and ReactOS generally do their thing well enough and they're not a significant target market (yet) as far as potential sales go. Still, you might want to code around known and persistent bugs or unsupported functionality (if you're happy to support the platforms) or signal a warning to their users of non-compatibility or non-support.

 proc getWindowsAPIVendor {} {
  if {[tk windowingsystem] != "win32"} { return -1 }
  package require registry 
  if {![catch { registry keys "HKEY_CURRENT_USER\\Software\\Wine\\X11 Driver" } junk]} {
    set ::win32(APIVendor) Wine 
  } elseif {![catch { registry keys "HKEY_CURRENT_USER\\Software\\ReactOS" } junk]} {
    set ::win32(APIVendor) ReactOS 
  } else {
    # If neither, we're (probably) on Microsoft Windows
    set ::win32(APIVendor) Microsoft
  }
  return "$::win32(APIVendor)"
 }
 getWindowsAPIVendor

 # Output to the user
 tk_messageBox -title "Info" -message "Hey there, [getWindowsAPIVendor] user! We're running on $::win32(APIVendor)"