|
-
Sep 28th, 2001, 11:41 AM
#1
Thread Starter
Addicted Member
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.
-
Sep 28th, 2001, 12:29 PM
#2
Thread Starter
Addicted Member
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...
-
Sep 28th, 2001, 03:20 PM
#3
Check with Spy++ and see if the window name shown is what you expect.
-
Sep 28th, 2001, 03:49 PM
#4
Thread Starter
Addicted Member
stupid mistake... I used "" instead of vbNullString... It now works
-
Sep 30th, 2001, 09:15 PM
#5
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.
-
Oct 1st, 2001, 09:57 AM
#6
Thread Starter
Addicted Member
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
-
Oct 1st, 2001, 12:27 PM
#7
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|