RE: Minimize CMD.EXE

new topic     » goto parent     » topic index » view thread      » older message » newer message

Thank you Al, but I could not get the the SetConsoleTitle to work. I am 
using XP pro and it need to research this further. For now, though, I 
was able to get the command window to launch first behind the primary 
one and that will do. I did this after trying your suggestion and 
realizing that I could use ?"" to launch the command window first. I had 
not used (or knew about) ?"" before your reply. 

Thanks -
Mike W.





Al Getz wrote:
> 
> 
> Mike W wrote:
> > 
> > 
> > Hi - 
> > 
> > Does anyone know if there is a way to use system_exec and not have the 
> > command window pop up? I need the return code from the called program, 
> > so I don't think I can use any shell code like WIN32Lib's 
> > shellExecuteEx. 
> > 
> > Thanks -
> > Mike W.
> > 
> 
> Hi Mike,
> 
> I had a program in exe form that absolutely HAD to be run with
> an attached console, so the best i could do was minimize the
> darn thing smile  Here's what i ended up doing:
> 
>     ?"" --force open console window
>     --other code
>     retv=c_func(xSetConsoleTitle,{lpConsoleTitle})
>     hConsole=c_func(xFindWindow,{0,lpConsoleTitle})
>     if hConsole!=0 then
>       --minimize this console window
>       retv=c_func(xShowWindow,{hConsole,6})
>     end if
> 
> First the console window is forced open with ?"" or
> printf(1,"%s","\n") or similar, then (in an onOpen event)
> the console window title is changed to some unusual
> name, then the handle is found with FindWindow(), then
> ShowWindow (passing the console window handle) minimizes it.
> 
> If the window title doesnt have to be changed you could
> try GetConsoleTitle instead of SetConsoleTitle.
> 
> Note that you may have to call Set or GetConsoleTitle
> in an onOpen event.  It may not work immediately after
> the print statement that opens the console for the first time.
> 
> Take care,
> Al

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu