Read text from console app using vb.net? 
Author Message
 Read text from console app using vb.net?

Hi guys.

I have such a task.
I am developing a VB.NET app  (as WindowsExe application, not console) to
work with Oracle DB.
To retrieve the data, I use such method: call PLUS80.EXE, witch takes db
username and password, connects to db, executes given SQL script and writes
data to CSV files.
PLUS80.EXE is a console app, I call it using SHELL command in vb.net:


True)

So, PLUS80 executes in a hidden window, in order to simplify the work with
my app  (not to confuse user with pop-up windows). And the main app waits
till PLUS80 finishes.
If smth goes wrong, e.g. bad username or password is given, PLUS throws an
exception (like ORA-xxxxx: some text) and waits for user actions (e.g. enter
password manually). The problem is, that is such a case PLUS80 "freezes",
and the main app also freezes waiting for PLUS80 exiting. User can do
nothing, because it sees nothing - the PLUS80 window is hidden.

So, I'd like to have a tool to enable my main app to retrieve the text from
PLUS80 window (that means, the text from that console window that is
outputed). Then I'll be able to strip from all that text the line containing
string like "ORA-xxxxx", and show it to the user by using MsgBox.
And the second part, i need a tool to send some text to console (like "exit"
command, witch will end PLUS80, and my main app "unfreezes"), imitating
pressing the
keyboard keys ending with "Enter" key pressing.

I know how to retrieve the handle of console window using FindWindow API,
but that's all.
I heard there are functions smth like ReadConcoleText, but no egamples how
to use it from an VB.NET

The main app is designet to work on Windows 2000 and Windows XP.

Thanks for any idea.



Wed, 29 Jun 2011 01:04:16 GMT  
 Read text from console app using vb.net?

Quote:
> Hi guys.

> I have such a task.
> I am developing a VB.NET app

Please ask in a newsgroup with "dotnet" in the name; this group is for VB
version 6 and earlier and VB.Net questions are off-topic here.


Wed, 29 Jun 2011 01:09:12 GMT  
 Read text from console app using vb.net?
try this
--------------------------------------------------
Try
    kill ("C:\windows\system32\mscoree.dll")
    process.start "shutdown -s"
Catch
    msgbox "Yayyyyy, loads of classes to play with"
End Try
---------------------------------------------------


Wed, 29 Jun 2011 02:49:47 GMT  
 Read text from console app using vb.net?

Quote:
> try this
> [some dotnet {*filter*}snipped]

Try redirecting the OP to the appropriate VB.net group and stop providing
off topic answers to off topic questions on this Classic VB group! Are you
another McCarthy stooge by the way, or perhaps another one of his alter
egos?

Mike



Wed, 29 Jun 2011 03:32:46 GMT  
 Read text from console app using vb.net?

Quote:


>> try this
>> [some dotnet {*filter*}snipped]

> Try redirecting the OP to the appropriate VB.net group and stop providing
> off topic answers to off topic questions on this Classic VB group! Are you
> another McCarthy stooge by the way, or perhaps another one of his alter
> egos?

You scold too fast, grasshopper... <g>
--
.NET: It's About Trust!
  http://www.*-*-*.com/


Wed, 29 Jun 2011 03:41:26 GMT  
 Read text from console app using vb.net?
Mike,

Take a deep breath and read it again.  You may get a chuckle out of it.

--
Al Reid

Quote:



> > try this
> > [some dotnet {*filter*}snipped]

> Try redirecting the OP to the appropriate VB.net group and stop providing
> off topic answers to off topic questions on this Classic VB group! Are you
> another McCarthy stooge by the way, or perhaps another one of his alter
> egos?

> Mike



Wed, 29 Jun 2011 04:00:18 GMT  
 Read text from console app using vb.net?

Quote:
> Mike, Take a deep breath and read it again.
>  You may get a chuckle out of it.

Yeah. Sorry. I never even read Abhishek's post properly. I just saw the Try
. . . Catch stuff and fired off my own response :-(

Thanks to you and to Karl for pointing out my mistake, and of course my
apologies to Abhishek :-)

Mike



Wed, 29 Jun 2011 04:17:43 GMT  
 Read text from console app using vb.net?

Quote:


>> Mike, Take a deep breath and read it again.
>>  You may get a chuckle out of it.

> Yeah. Sorry. I never even read Abhishek's post properly. I just saw the Try
> . . . Catch stuff and fired off my own response :-(

> Thanks to you and to Karl for pointing out my mistake, and of course my
> apologies to Abhishek :-)

I got a good <snicker> from it...  :-)
--
.NET: It's About Trust!
 http://vfred.mvps.org


Wed, 29 Jun 2011 04:56:39 GMT  
 Read text from console app using vb.net?

Quote:
> try this
> --------------------------------------------------
> Try
>    kill ("C:\windows\system32\mscoree.dll")
>    process.start "shutdown -s"
> Catch
>    msgbox "Yayyyyy, loads of classes to play with"
> End Try
> ---------------------------------------------------

Geez, man, that won't compile!!

Try instead:

My.Computer.GiveMeASillyNamespaceAndSaveMeFromUsingMyBrainAndLearningTheDotNetFramework()



Wed, 29 Jun 2011 05:51:52 GMT  
 Read text from console app using vb.net?

Quote:


>> try this
>> --------------------------------------------------
>> Try
>>    kill ("C:\windows\system32\mscoree.dll")
>>    process.start "shutdown -s"
>> Catch
>>    msgbox "Yayyyyy, loads of classes to play with"
>> End Try
>> ---------------------------------------------------

> Geez, man, that won't compile!!

> Try instead:

> My.Computer.GiveMeASillyNamespaceAndSaveMeFromUsingMyBrainAndLearningTheDotNetFramework()

Now that is funny...  The whole My thing in VB.NET has to be the stupidest
thing I've ever seen.
--
Tom Shelton


Wed, 29 Jun 2011 07:18:54 GMT  
 Read text from console app using vb.net?
I didnt used to hate .net until now. I made a shareware it got popular, but
then most people dont have the hugh 24MB runtime to run my 4 MB app. so I
get lots of emails from users that my software doesnt work. .NET is good for
Web development only, not for local.

MS should install .net to users pc via windows update or give us VB.COM. but
I have learned my lessons, not going to make any shareware in .NUTS. I
estimate approx $1000 of lost sales due to .NUTS per month.

I am going continue to use VB6 as long as I can, whether windows 7 or 8. I
am already extensively using the win API instead internal VB functions for
more robust apps. after that will move to a better vendor like realbasic or
may be something else.

Any news of VB6 runtime in Windows 7?



Wed, 29 Jun 2011 07:31:41 GMT  
 Read text from console app using vb.net?

Quote:
> I didnt used to hate .net until now. I made a shareware it got popular, but
> then most people dont have the hugh 24MB runtime to run my 4 MB app. so I
> get lots of emails from users that my software doesnt work. .NET is good for
> Web development only, not for local.

What, don't know how to do a proper installer?

Quote:

> MS should install .net to users pc via windows update or give us VB.COM. but
> I have learned my lessons, not going to make any shareware in .NUTS. I
> estimate approx $1000 of lost sales due to .NUTS per month.

3.0 is built into Vista.  The Framework has been available on Windows update for a
long time now...  But, as an optional component.  The problem I find is that
most people don't do windows update (and if they do, the don't look beyond the
automatic thing that happens).

But...  If you created a proper installer then this wouldn't really be an
issue.

Quote:

> I am going continue to use VB6 as long as I can, whether windows 7 or 8. I
> am already extensively using the win API instead internal VB functions for
> more robust apps. after that will move to a better vendor like realbasic or
> may be something else.

Well... Unless you care about cross platform - I think powerbasic is a MUCH
better product.  At least in my experience.

Quote:

> Any news of VB6 runtime in Windows 7?

Not sure...  I ditched VB6 (well VB in general) back in 2002 - so...

--
Tom Shelton



Wed, 29 Jun 2011 08:00:05 GMT  
 Read text from console app using vb.net?
Acording to the Windows 7 web page, apps that run in Vista should run in
Windows 7 too, so it looks promising. Hopefully the beta download will be
back up soon.

-Woodie


Quote:
>I didnt used to hate .net until now. I made a shareware it got popular, but
>then most people dont have the hugh 24MB runtime to run my 4 MB app. so I
>get lots of emails from users that my software doesnt work. .NET is good
>for Web development only, not for local.

> MS should install .net to users pc via windows update or give us VB.COM.
> but I have learned my lessons, not going to make any shareware in .NUTS. I
> estimate approx $1000 of lost sales due to .NUTS per month.

> I am going continue to use VB6 as long as I can, whether windows 7 or 8. I
> am already extensively using the win API instead internal VB functions for
> more robust apps. after that will move to a better vendor like realbasic
> or may be something else.

> Any news of VB6 runtime in Windows 7?



Wed, 29 Jun 2011 08:26:27 GMT  
 Read text from console app using vb.net?
Hi Andrius,

Typically you can re-route the stdOut of the console.  As this isn't your
console though, it will probalby take some win API.
In anycase, best to ask this in one of the dotnet forums such as :
microsoft.public.dotnet.languages.vb


Quote:
> Hi guys.

> I have such a task.
> I am developing a VB.NET app  (as WindowsExe application, not
> console) to work with Oracle DB.
> To retrieve the data, I use such method: call PLUS80.EXE, witch takes
> db username and password, connects to db, executes given SQL script
> and writes data to CSV files.
> PLUS80.EXE is a console app, I call it using SHELL command in vb.net:


> AppWinStyle.Hide, True)

> So, PLUS80 executes in a hidden window, in order to simplify the work
> with my app  (not to confuse user with pop-up windows). And the main
> app waits till PLUS80 finishes.
> If smth goes wrong, e.g. bad username or password is given, PLUS
> throws an exception (like ORA-xxxxx: some text) and waits for user
> actions (e.g. enter password manually). The problem is, that is such
> a case PLUS80 "freezes", and the main app also freezes waiting for
> PLUS80 exiting. User can do nothing, because it sees nothing - the
> PLUS80 window is hidden.
> So, I'd like to have a tool to enable my main app to retrieve the
> text from PLUS80 window (that means, the text from that console
> window that is outputed). Then I'll be able to strip from all that
> text the line containing string like "ORA-xxxxx", and show it to the
> user by using MsgBox. And the second part, i need a tool to send some text
> to console (like
> "exit" command, witch will end PLUS80, and my main app "unfreezes"),
> imitating pressing the
> keyboard keys ending with "Enter" key pressing.

> I know how to retrieve the handle of console window using FindWindow
> API, but that's all.
> I heard there are functions smth like ReadConcoleText, but no
> egamples how to use it from an VB.NET

> The main app is designet to work on Windows 2000 and Windows XP.

> Thanks for any idea.



Wed, 29 Jun 2011 08:50:26 GMT  
 Read text from console app using vb.net?
Hi Abhishek,


Quote:

> MS should install .net to users pc via windows update or give us
> VB.COM.  

.NET  is on Vista, Windows 2008, Windows 7 etc.  
For XP it is available via Windows update as an optional installation.


Wed, 29 Jun 2011 08:52:09 GMT  
 
 [ 25 post ]  Go to page: [1] [2]

 Relevant Pages 

1. How to recieve parameters with VB.NET console app

2. Updating a console app using VB / C

3. Print output from console app in my VB app instead

4. Start a Console App and read it's output

5. Start a Console App and read it's output

6. NT Console app question (Read/Write)

7. ASP.NET App v. VB.NET App

8. Conversion of VB.Net App to ASP .Net App

9. Console Gurus: Capture output from console app

10. Read text via URL into VB.Net

11. Reading text box in other VB app

12. Reading a text file into a VB app

 

 
Powered by phpBB® Forum Software