Z
Zach Dennis
I spent the last hour figuring out how to hide the cmd.exe (dos) window/ruby
interpreter when running my ruby script. I didn't see any direct answers to
this question so here is how I got it to work.
require 'Win32API'
getConsoleWindow = Win32API.new("kernel32" , "GetConsoleWindow" , [] , 'L')
ptr_to_console = getConsoleWindow.call()
wndConsole = Win32API.new( "user32" , "ShowWindow" , ['p' , 'i'] , 'i' )
bl = wndConsole.call( ptr_to_console , 1 )
To do a quick test you can do:
require 'Win32API'
require 'tk'
getConsoleWindow = Win32API.new("kernel32" , "GetConsoleWindow" , [] , 'L')
ptr_to_console = getConsoleWindow.call()
wndConsole = Win32API.new( "user32" , "ShowWindow" , ['p' , 'i'] , 'i' )
wndConsole.call( ptr_to_console , 1 )
Tk.mainloop
interpreter when running my ruby script. I didn't see any direct answers to
this question so here is how I got it to work.
require 'Win32API'
getConsoleWindow = Win32API.new("kernel32" , "GetConsoleWindow" , [] , 'L')
ptr_to_console = getConsoleWindow.call()
wndConsole = Win32API.new( "user32" , "ShowWindow" , ['p' , 'i'] , 'i' )
bl = wndConsole.call( ptr_to_console , 1 )
To do a quick test you can do:
require 'Win32API'
require 'tk'
getConsoleWindow = Win32API.new("kernel32" , "GetConsoleWindow" , [] , 'L')
ptr_to_console = getConsoleWindow.call()
wndConsole = Win32API.new( "user32" , "ShowWindow" , ['p' , 'i'] , 'i' )
wndConsole.call( ptr_to_console , 1 )
Tk.mainloop