Click to See Complete Forum and Search --> : Redirecting Dos IO
KrishnaSantosh
Feb 7th, 2001, 06:21 AM
Hello
Can Any Please Say Me How To Redirect Dos Input and Output To My Form. I Know That This can Be Done, Byt I Dont Know The Exact Procedure.
Can Anyone Please Help Me.
My Email Is : santoshkrishna@santoshsmail.com
jonaxse
Feb 8th, 2001, 10:37 AM
Hmmm.... In all my VB programming years (1.75 years), I`ve always wondered about this... until I finally gave up.
I have found an alternative tho`....
Look up, FileSystemObjects or FileSystemObject (damn! I cant spell right!)
Take a reference to it in your project: Microsoft Scripting Runtime
then you can:
Dim objFolder as Scripting.Folder
Dim objFileSysObj as Scripting.FileSystemObject
Dim objFile as Scripting.File
...these objects are capable of file operations. You will only need to emulate the terminal window of the DOS Command prompt.
as of the present, I have not discovered another way of solving this.... but if ever you do, would you please inform me? I`d really like to know.
:)
email: joanreysedigo@usa.net
(You dont have to mail me if this is taking your time.. I dun wanna bother ya`, but if you like, you can mail me)
Hope that helps :)
Bios
Feb 9th, 2001, 06:09 AM
I've only found one way, and it is a really really unstable, and ammature way of doing this...you can get the text in the dos council window by shelling to whatever your running in a Normal window (it can't be fullscreen), and then using sendkeys to press CTRL+C,and get the data out of the clipboard, and vice versa for sending data to it (set the clipboard and then sendkeys CTRL+V)
This can work error free as long as you use API to find the window of the command prompt, and get it's caption, and appactivate that title.
I know this is "BOOTLEG", but oh well
:D Hope this helps atleast alittle,
Bios
prakashkrishna
Feb 9th, 2001, 08:09 AM
thanks all
but i thought and still think that there is some trick with the CreateProcess API would do some good.What do you ppl think.
KrishnaSantosh
Feb 9th, 2001, 08:14 AM
Thanks all .
I posted my reply by mistake from prakashkrishna's thread who is my friend.
I think createProcess would work.what do u think
jonaxse
Feb 9th, 2001, 01:49 PM
The CreateProcess function creates a new process and its primary thread. The new process executes the specified executable file.
Does this sound like it can work? I dont think so.
It could be another Win32 API ...but definitely not CreateProcess.
Lord Orwell
Feb 10th, 2001, 02:39 AM
i leave the details to you, since i have no clue if it will work.
Get the standard input and output handles (using the getstdhandle api call) and use writeconsole and readconsole api to read and write data to the dos window open. It SHOULD read and write to and from an open dos window since it is a console text window. I have never tried it however.
KrishnaSantosh
Feb 11th, 2001, 01:00 AM
Thanks,
But I Dont want DoS Window To Open. It Should Be Invisible. But The Input Should Be Provided And The Output should Be Obtained Using Custom Form. I've Seen these In FreeJava(RealJ), Kawa, etc..., though haven't got it myself yet.
Lord Orwell
Feb 14th, 2001, 01:59 AM
Well you could always open the window minimized, then use api to hide it: showwindow(hwnd, sw_hide)
KrishnaSantosh
Feb 14th, 2001, 05:07 AM
Yeah Thanks.
And If It Is Hidden How To Send The Input And Get The Output.
noble
Feb 14th, 2001, 06:30 AM
if you go to planet source code, there is a module
somebody wrote in vb that redirects all the output to
your program. StdShellLib or something it's called
but it works great!
Lord Orwell
Feb 16th, 2001, 02:25 AM
just cuz you can't see it doesnt mean it isnt there. all api calls will still work on it.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.