Results 1 to 7 of 7

Thread: Console window

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Location
    Mexico City
    Posts
    242

    Console window

    Hi,

    I know how to open a console window and send output to it, but is it possible to attach that window to my main program window? or completely hide the console window?

    Thanks in advance.

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Location
    Mexico City
    Posts
    242
    I tried doing this by retrieving the hWnd of the console window, so I could use SetParent to attach the console to another window. This is what I did:

    Code:
    Randomize Timer ' Create a unique id to find the window
    sTitle = "ZBINST: " & Rnd()
    SetConsoleTitle sTitle ' Set the console title to a unique string
    Sleep 40 ' Wait for the title to be updated
    hWnd = FindWindow("", sTitle) ' Find the window
    But, hWnd returns 0, and so does GetLastError, so I don't know where the error is...

  3. #3
    Megatron
    Guest
    Check with Spy++ and see if the window name shown is what you expect.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Location
    Mexico City
    Posts
    242
    stupid mistake... I used "" instead of vbNullString... It now works

  5. #5
    Tygur
    Guest
    I'm not too sure because I didn't test it, but I don't think that Sleep line makes a difference. It doesn't look like it makes any difference because it freezes everything your app is doing. So how can the titlebar be getting updated during that time? I think the titlebar is already updated after you set the title. You might not need to have your program wait.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Location
    Mexico City
    Posts
    242
    Originally posted by Tygur
    I'm not too sure because I didn't test it, but I don't think that Sleep line makes a difference. It doesn't look like it makes any difference because it freezes everything your app is doing. So how can the titlebar be getting updated during that time? I think the titlebar is already updated after you set the title. You might not need to have your program wait.
    The console runs asynchronously from the main app, so I rather be completely sure the title gets updated

  7. #7
    Tygur
    Guest
    Originally posted by gxpark


    The console runs asynchronously from the main app, so I rather be completely sure the title gets updated
    Well I just tested it out and you're right. It does run asyncronously. I've never realized that before..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width