PC Review


Reply
Thread Tools Rate Thread

How to communicate to an executing C program from VB.NET

 
 
hlam
Guest
Posts: n/a
 
      10th Oct 2003
I am developing a VB application using Visual Studio.NET
and I need to communicate with a C program (supplying it
with inputs and receiving output from it). What is the
best way to do this?

Thanks in advance,
H. Lam
 
Reply With Quote
 
 
 
 
Tom Shelton
Guest
Posts: n/a
 
      10th Oct 2003
On 2003-10-10, hlam <(E-Mail Removed)> wrote:
> I am developing a VB application using Visual Studio.NET
> and I need to communicate with a C program (supplying it
> with inputs and receiving output from it). What is the
> best way to do this?
>
> Thanks in advance,
> H. Lam


What kind of app is the C app? Is it a console application or is it a
typical Windows GUI?

If it is a console application, you can use the
System.Diagnostics.Process class to start the process and redirect the
stdin and stdout to you program.

Anyway, you need to supply more information...

--
Tom Shelton
MVP [Visual Basic]
 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      10th Oct 2003
* "hlam" <(E-Mail Removed)> scripsit:
> I am developing a VB application using Visual Studio.NET
> and I need to communicate with a C program (supplying it
> with inputs and receiving output from it). What is the
> best way to do this?


Please provide more details about the C application. Do you have the
source code? Is it a console application or does it have windows?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
 
Reply With Quote
 
hlam
Guest
Posts: n/a
 
      10th Oct 2003
It is a c app that we will be writing that can be executed
from a DOS prompt. We also want it to be an "engine" to
the VB app so the VB app can call it to pass it data and
get data in return.

Thanks in advance for your help.
H. Lam


>-----Original Message-----
>On 2003-10-10, hlam <(E-Mail Removed)> wrote:
>> I am developing a VB application using Visual

Studio.NET
>> and I need to communicate with a C program (supplying

it
>> with inputs and receiving output from it). What is the
>> best way to do this?
>>
>> Thanks in advance,
>> H. Lam

>
>What kind of app is the C app? Is it a console

application or is it a
>typical Windows GUI?
>
>If it is a console application, you can use the
>System.Diagnostics.Process class to start the process and

redirect the
>stdin and stdout to you program.
>
>Anyway, you need to supply more information...
>
>--
>Tom Shelton
>MVP [Visual Basic]
>.
>

 
Reply With Quote
 
Tom Shelton
Guest
Posts: n/a
 
      10th Oct 2003
In article <0e6901c38f3e$d9330650$(E-Mail Removed)>, hlam wrote:
> It is a c app that we will be writing that can be executed
> from a DOS prompt. We also want it to be an "engine" to
> the VB app so the VB app can call it to pass it data and
> get data in return.
>
> Thanks in advance for your help.
> H. Lam
>
>


Ahh, then it is a console application. Then you'll want to look at the
System.Diagnostics class. With that class you can start the application,
and redirect it's stdin and stdout to your own application... There is
a thread here were I already posted some example source of this. It is
discussing ReadConsoleOutput and ReadConsoleOutputChar. If you look for
those in the subject you'll find it

HTH

--
Tom Shelton
MVP [Visual Basic]
 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      10th Oct 2003
* "hlam" <(E-Mail Removed)> scripsit:
> It is a c app that we will be writing that can be executed
> from a DOS prompt. We also want it to be an "engine" to
> the VB app so the VB app can call it to pass it data and
> get data in return.


Have a look at this sample:

<http://www.mvps.org/dotnet/dotnet/samples/miscsamples/downloads/RedirectConsole.zip>

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
 
Reply With Quote
 
Guest
Posts: n/a
 
      15th Oct 2003
Thanks. I will definitely take a look.

H. Lam


>-----Original Message-----
>* "hlam" <(E-Mail Removed)> scripsit:
>> It is a c app that we will be writing that can be

executed
>> from a DOS prompt. We also want it to be an "engine" to
>> the VB app so the VB app can call it to pass it data

and
>> get data in return.

>
>Have a look at this sample:
>
><http://www.mvps.org/dotnet/dotnet/sa...iscsamples/dow

nloads/RedirectConsole.zip>
>
>--
>Herfried K. Wagner
>MVP · VB Classic, VB.NET
><http://www.mvps.org/dotnet>
>.
>

 
Reply With Quote
 
Guest
Posts: n/a
 
      15th Oct 2003

Thanks for the tip. I'll will go search for it.

H. Lam
>-----Original Message-----
>In article <0e6901c38f3e$d9330650$(E-Mail Removed)>, hlam

wrote:
>> It is a c app that we will be writing that can be

executed
>> from a DOS prompt. We also want it to be an "engine" to
>> the VB app so the VB app can call it to pass it data

and
>> get data in return.
>>
>> Thanks in advance for your help.
>> H. Lam
>>
>>

>
>Ahh, then it is a console application. Then you'll want

to look at the
>System.Diagnostics class. With that class you can start

the application,
>and redirect it's stdin and stdout to your own

application... There is
>a thread here were I already posted some example source

of this. It is
>discussing ReadConsoleOutput and ReadConsoleOutputChar.

If you look for
>those in the subject you'll find it
>
>HTH
>
>--
>Tom Shelton
>MVP [Visual Basic]
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing a program tshad Microsoft ASP .NET 6 14th Oct 2009 09:10 PM
How to run and communicate a DOS program file in a VB.NET program? tsung-yu Microsoft VB .NET 9 27th Nov 2006 09:41 PM
Executing a program =?Utf-8?B?bWFqaWQ=?= Microsoft Dot NET 1 23rd Oct 2004 07:00 PM
Re: Executing a program as a different user Torgeir Bakken \(MVP\) Windows XP Customization 0 1st Sep 2004 02:39 PM
Re: Executing a program as a different user name Microsoft Windows 2000 CMD Promt 0 31st Aug 2004 05:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:47 PM.