1. detecting windows

One can use the following function to detect if an euphoria program is
running under windows.
information source : La Bible PC, by Micheal Tischer, Ed. Micro
applications.


atom WinVer

function WindowIsRunning()
-- check if euphoria program is running under window
-- return 0 if windows not detected.
sequence r
integer r_AL
  r = repeat(0,10)
  r[REG_AX] = #1600
  r = dos_interrupt(MULTIPLEX,r)
  r_AL = remainder(r[REG_AX],256)
  if r_AL = 1 or r_AL = 255 then
    WinVer = 2.00
    return 1
  elsif  r_AL = 0 or r_AL = #80 then
    r[REG_AX] = #4680
    r = dos_interrupt(MULTIPLEX,r)
    r_AL = remainder(r[REG_AX],256)
    if r_AL = #80 then
        WinVer = 0
        return 0 -- windows not running
    else
        WinVer = 3.00
        return 1
    end if
  else --windows is running in extended mode, version in ax,
al=major,ah=minor
    WinVer = r_AL + floor(r[REG_AX]/256)/100
    return 1
  end if
end function  -- WindowIsRunning()

Jacques Deschenes

new topic     » topic index » view message » categorize

2. Re: detecting windows

Jacques,

another neat routine!  The installer I wrote in Euphoria
needs to know if Windows is running - it invokes a pgm that
will fail under windows.  I do a

  if atom(getenv("windir")) then
    return FALSE
  end if
  return TRUE

Your routine is more elegant & provides more info.

John Kinne

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu