Getting system properties and executing files

BlitzMax Forums/BlitzMax Programming/Getting system properties and executing files

*(Posted 2006) [#1]
Does anyone know how to get the system properties and executing files in max, from what I can see in the docs there is no SystemProperty or ExecFile commands.


TartanTangerine (was Indiepath)(Posted 2006) [#2]
Yep, it's WinAPI specific


Eikon(Posted 2006) [#3]
Depends on what you want to do. As Indie suggested, most of the systemproperty stuff can be done with win API. For the window handle there's GetActiveWindow. ExecFile is now System_, but it halts program execution. Kernel32's WinExec might allow execution to continue, I haven't tried.


*(Posted 2006) [#4]
thanks will have a look, what I want to do is get the directory of where windows is installed to


Eikon(Posted 2006) [#5]
You're welcome. Try this for the windows directory:
Extern "win32"
	Function GetWindowsDirectory(lpBuffer:Byte Ptr, nSize) = "GetWindowsDirectoryA@8"
End Extern

Local winDir:TBank = CreateBank(260)
GetWindowsDirectory BankBuf(winDir), 260

Print String.FromCString(BankBuf(winDir))



*(Posted 2006) [#6]
thanks eikon will have a looky :D


EOF(Posted 2006) [#7]
For launching apps see my Max tutorial called:

Launching a program

http://www.blitzmax.com/Community/posts.php?topic=53709


TartanTangerine (was Indiepath)(Posted 2006) [#8]
thanks will have a look, what I want to do is get the directory of where windows is installed to

You should really be using Environment Variables for this stuff.


*(Posted 2006) [#9]
Indiepath: do you have a source example?


TartanTangerine (was Indiepath)(Posted 2006) [#10]
http://msdn2.microsoft.com/77zkk0b6.aspx

http://www.wilsonmar.com/1envvars.htm

I think there is a function in the code archives that uses a .decls file to get the variable detailes.


kfprimm(Posted 2006) [#11]
Print "Windows is installed to "+GetEnv("SystemRoot")

Function GetEnv:String(env_var:String)
	Return String(getenv_(env_var))
End Function


For a complete set of varibles go to the command prompt and type set


*(Posted 2006) [#12]
thanks guys that will is a great help :D