UseShellExecute problems

JimXugle

New member
Joined
Jun 12, 2008
Messages
1
Programming Experience
1-3
I'm working on a GUI frontend for GnuPG. VB complained about the UseShellExecute property not being set to false, so I specified it to be false. Despite this, VB still stops at testsetup.Start() with "The Process object must have the UseShellExecute property set to false in order to redirect IO streams."

What am I missing?

VB.NET:
Private Sub GnuPGW32_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
OpenDialog.CheckFileExists.Equals(True)

        Dim versionstring As String
        ' gpgpath.Text is the path to the gpg executable. 
        ' this is usually C:\Program Files\GNU\GnuPG\gpg.exe
        If FileIO.FileSystem.FileExists(gpgpath.Text) Then
            Dim testsetup As Process = New Process()
            testsetup.StartInfo.FileName = gpgpath.Text
            testsetup.StartInfo.Arguments = "--version"
            testsetup.StartInfo.CreateNoWindow = True
            testsetup.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
            testsetup.StartInfo.RedirectStandardOutput = True
            testsetup.StartInfo.UseShellExecute = False
            testsetup.Start()
            versionstring = testsetup.StandardOutput.ReadLine()
            VersionLabel.Text = versionstring

        End If

End Sub

Thanks a Million

-JimXugle (pro n00b)
 

Attachments

  • GnuPGW32.zip
    14.6 KB · Views: 15
Last edited by a moderator:
The code runs fine when I test it. Try removing your binaries (obj+bin folders), perhaps the compiler just got stuck and you don't get a fresh build.
 
Back
Top