TIP: Click on subject to list as thread! ANSI
echo: clipper
to: BRYAN SMITH
from: LUDGER CLEMENS
date: 1996-11-12 00:00:00
subject: Is it Windows ?

Hello Bryan,
on 08-Nov-96 you asked here for
                       -= Is it Windows ? =-
BS> Does anybody know a way in which a Clipper program which is running
BS> under Windows could determine that it is running in a Windows DOS box,
BS> and not in raw DOS ?
While asking for the result of GetEnv("windir") - lower case! - fails, it's  
necessary to get these "SET" informations in another way.
First way, using the "Nanfor.Lib"
FUNCTION IsMS_Windows()
local cEnv := ""
FT_Gete( @cEnv )
return ( "windir" $ cEnv )
Second way, pure Clipper
FUNCTION IsMS_Windows()
local cEnv := cTemp := ""
local nHandle := nLength := 0
local nRetVal := -1
/****
   let "SET" run into a temporary file and inspect this file
****/
cTemp     := "_______T.$$$"
run set > &cTemp
if file( cTemp )
  nHandle     := fopen( cTemp )
  if empty( ferror() )
     nLength  := fseek( nHandle, 0, 2 )
     fseek( nHandle, 0, 0 )
     cEnv     := freadstr( nHandle, nLength )
     fclose(nHandle)
     ferase( cTemp )
     nRetVal  := iif( "windir" $ cEnv, 1, 0 )
  endif
endif
return nRetVal
---
Ciao, Ludger
--- CrossPoint v3.11 R
---------------
* Origin: { || Clipperians do it within codeblocks } (2:2448/300.59)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.