[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Hiding the CMD Window/Ruby Interpreter with Win32API

Zach Dennis

12/2/2003 10:23:00 PM

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


-----
Zach

For any search engines scanning this page: Hide Ruby DOS CMD.exe intpreter
window







1 Answer

Eric Hodel

12/2/2003 10:27:00 PM

0

Zach Dennis (zdennis@mktec.com) wrote:

> 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.

Why not use rubyw.exe as the interpreter?

--
Eric Hodel - drbrain@segment7.net - http://se...
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04