1. dos window

Hello Everbody,

I know how to close a window window with,

      close(myWindow) 
  

How do I close a dos window ?

For example: "e:/euphoria/bin.exe".

Thank you,

Don Cole

new topic     » topic index » view message » categorize

2. Re: dos window

The close() function is for files opened with open(). To release the console window, use free_console().

-Greg

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

3. Re: dos window

ghaberek said...

The close() function is for files opened with open(). To release the console window, use free_console().

-Greg

Thank Greg for your quick response.

Howeever

I guess I asked the wrong question (my bad).

What I would really like to know is:

How do you setFocus(*)?

  • being the dos window, the console window or whatever you want to call it.

Thank you,

Don Cole

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

4. Re: dos window

Use GetConsoleWindow to get the current console window for your application. However, according to this StackOverflow thread, you cannot SetFocus to other top-level windows (frankly, it's rude). Indeed I tried but it did not work. But you can use FlashWindow to draw focus from the user without forcing your hand. This example will flash the current console window. It also shows how to detect if you currently have a window, which could be helpful before calling free_console().

http://stackoverflow.com/questions/3223688/set-focus-on-console-in-windows

include std/dll.e 
include std/machine.e 
include std/os.e 
include std/types.e 
 
constant 
    kernel32    = open_dll( "kernel32.dll" ), 
    user32      = open_dll( "user32.dll" ), 
$ 
 
constant 
    xGetConsoleWindow   = define_c_func( kernel32, "GetConsoleWindow", {}, C_HWND ), 
    xFlashWindow        = define_c_func( user32, "FlashWindow", {C_HWND,C_BOOL}, C_HWND ), 
$ 
 
public function GetConsoleWindow() 
    return c_func( xGetConsoleWindow, {} ) 
end function 
 
public function FlashWindow( atom hwnd, boolean invert = TRUE ) 
    return c_func( xFlashWindow, {hwnd,invert} ) 
end function 
 
-- get the console window 
atom hwnd = GetConsoleWindow() 
 
if hwnd = NULL then 
    -- no window exists 
     
    -- force a console window 
    puts( 1, "\n" ) 
     
    -- get the handle again 
    hwnd = GetConsoleWindow() 
     
end if 
 
for i = 1 to 4 do 
     
    -- flash the window 
    FlashWindow( hwnd ) 
     
    -- sleep briefly before flashing again 
    sleep( 0.5 ) 
     
end for 

-Greg

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

Search



Quick Links

User menu

Not signed in.

Misc Menu