Jump to content

Hiding a Window


Recommended Posts

Hi, I am making a program that opens a command prompt (hidden) and then runs PuTTY. The code is like this:

$cmd_win = @ComSpec 
    $pid = Run($cmd_win, "C:\")
    If @error Then Exit MsgBox(0, "Error PID", $pid)

    Sleep(500)
    ControlSend('[CLASS:ConsoleWindowClass]', '', '', 'cd "Program Files\Putty"' & '{ENTER}')
    Sleep(300)
    ControlSend('[CLASS:ConsoleWindowClass]', '', '', 'putty.exe -telnet 213.249.17.139' & '{ENTER}')

I want to have the PuTTY window start hidden as well. Is this possible?

I tried using WinSetState ('[CLASS:PuTTY]', '', @SW_HIDE) right after the last line, but still I get the PuTTY window for a second or so before it hides...

(Don't ask me to start PuTTY directly, without using the command line. When I do this, the logging feature of PuTTY doesn't work for some reason...)

Paris

Link to comment
Share on other sites

did you use WinWaitActive('[CLASS:PuTTY]', '', @SW_HIDE) and then WinSetState ('[CLASS:PuTTY]', '', @SW_HIDE) ?

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

Try the following:

#include <constants.au3>
$a = Run('"C:\Program Files\Putty\putty.exe" -telnet 213.249.17.139', "C:\Program Files\Putty", @SW_HIDE, $STDERR_CHILD+$STDOUT_CHILD)
local $t
While Not @error
    $t &= StdoutRead($a)
WEnd
Msgbox(0,"",$t)oÝ÷ ÚÚºÚ"µÍ[ÛÛÜXÈ    [È ÌÎNÈÐÈ ][ÝÐÎÌLÔÙÜ[H[ÉÌLÔ]IÌLÜ]K^I][ÝÈ][]LËKMËLÎIÌÎNË   ][ÝÐÎÌLÔÙÜ[H[ÉÌLÔ]I][ÝËÝ×ÚYJBÚ[ØZ]XÝ]J    ][ÝÖÐÓTÔÎUWI][ÝÊBÚ[Ù]Ý]J ][ÝÖÐÓTÔÎUWI][ÝËÕ×ÒQJ

senthor

Edited by senthor
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...