Click here to Skip to main content
15,890,512 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: give me a suggestion Pin
satc19-Aug-11 7:39
satc19-Aug-11 7:39 
GeneralRe: give me a suggestion Pin
Dave Kreskowiak19-Aug-11 11:59
mveDave Kreskowiak19-Aug-11 11:59 
AnswerRe: give me a suggestion Pin
Simon_Whale16-Aug-11 12:33
Simon_Whale16-Aug-11 12:33 
AnswerRe: give me a suggestion Pin
Bert Mitton18-Aug-11 3:30
professionalBert Mitton18-Aug-11 3:30 
AnswerRe: give me a suggestion Pin
Аslam Iqbal23-Aug-11 8:28
professionalАslam Iqbal23-Aug-11 8:28 
QuestionMultiple Configuration Files In One Application Pin
KenBonny16-Aug-11 0:07
KenBonny16-Aug-11 0:07 
AnswerRe: Multiple Configuration Files In One Application Pin
Mehdi Gholam21-Aug-11 22:43
Mehdi Gholam21-Aug-11 22:43 
QuestionProcess creation error in Win 7 Pin
Gagan.2015-Aug-11 0:58
Gagan.2015-Aug-11 0:58 
Hi all...

I wrote an application in VB.NET (VS 2008) to start a process and read its output error.

The code is given below :


Private Function getProcessOutput(ByVal processName As String, ByVal args As String, ByVal processPath As String)
        Dim output As String = ""
        Try
            Dim prc As Process = New Process    'Create object of Process.
            Dim prcInfo As New ProcessStartInfo 'Create object of ProcessStartInfo
            With prcInfo                        'Set attributes to ProcessStartInfo object.
                .FileName = processName         'processname to start
                .Arguments = args               'filename is passed as argument
                .CreateNoWindow = True          'Make background process
                .UseShellExecute = False        'Set to false to redirect output/error.
                .RedirectStandardOutput = True  'Enable output redirection
                .RedirectStandardError = True   'Enable error redirection
                .WorkingDirectory = processPath 'working directory where process file is stored.
            End With
            prc.StartInfo = prcInfo
            prc.Start()

                    prc.BeginOutputReadLine()   'Start reading output in asynchronous way.
                    output = prc.StandardError.ReadToEnd()  'Read whole error.
                    prc.WaitForExit()   'wait for process to exit.
      Catch ex as Exception
            Msgbox(ex.message)
      End Try

        Return output       'Return output whether it is error or program output.
    End Function


This function is working pretty well in Windows XP but when I am trying to run this code in Win 7, it throws an exception that file not found.

I checked process name and working directory for the file which I want to run but still it is generating same error message.

Suggest me what should I do.

Thanks.
Gagan

AnswerRe: Process creation error in Win 7 Pin
Luc Pattyn15-Aug-11 1:51
sitebuilderLuc Pattyn15-Aug-11 1:51 
GeneralRe: Process creation error in Win 7 Pin
Gagan.2015-Aug-11 2:22
Gagan.2015-Aug-11 2:22 
AnswerRe: Process creation error in Win 7 [typo fixed] Pin
Luc Pattyn15-Aug-11 2:42
sitebuilderLuc Pattyn15-Aug-11 2:42 
GeneralRe: Process creation error in Win 7 Pin
Gagan.2015-Aug-11 2:58
Gagan.2015-Aug-11 2:58 
GeneralRe: Process creation error in Win 7 Pin
DaveAuld15-Aug-11 3:17
professionalDaveAuld15-Aug-11 3:17 
AnswerRe: Process creation error in Win 7 Pin
Luc Pattyn15-Aug-11 3:52
sitebuilderLuc Pattyn15-Aug-11 3:52 
QuestionTCPclient/TCPlistener connects but can't send/receive data? Please help. Pin
LCARS x3211-Aug-11 4:26
LCARS x3211-Aug-11 4:26 
AnswerRe: TCPclient/TCPlistener connects but can't send/receive data? Please help. Pin
MikeD 216-Aug-11 2:37
MikeD 216-Aug-11 2:37 
QuestionError while retrieving records between two dates Pin
Gagan.2011-Aug-11 3:20
Gagan.2011-Aug-11 3:20 
AnswerRe: Error while retrieving records between two dates Pin
Dave Kreskowiak11-Aug-11 3:33
mveDave Kreskowiak11-Aug-11 3:33 
GeneralRe: Error while retrieving records between two dates Pin
Gagan.2011-Aug-11 3:50
Gagan.2011-Aug-11 3:50 
GeneralRe: Error while retrieving records between two dates Pin
Dave Kreskowiak11-Aug-11 5:21
mveDave Kreskowiak11-Aug-11 5:21 
GeneralRe: Error while retrieving records between two dates Pin
Gagan.2011-Aug-11 21:25
Gagan.2011-Aug-11 21:25 
GeneralRe: Error while retrieving records between two dates Pin
Dave Kreskowiak12-Aug-11 1:57
mveDave Kreskowiak12-Aug-11 1:57 
GeneralRe: Error while retrieving records between two dates Pin
Dave Kreskowiak19-Aug-11 4:20
mveDave Kreskowiak19-Aug-11 4:20 
AnswerRe: Error while retrieving records between two dates Pin
Member 815382311-Aug-11 3:42
Member 815382311-Aug-11 3:42 
AnswerRe: Error while retrieving records between two dates Pin
Wayne Gaylard11-Aug-11 21:14
professionalWayne Gaylard11-Aug-11 21:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.