Results 1 to 7 of 7

Thread: [2008]Processstart Q

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    74

    Question [2008]Processstart Q

    If I use Shell(myapp.exe) how is it different than double clicking on the myapp.exe ?

    see the thing is that myapp.exe is written in other language(autoitscript) & it supposed to read contents of 1 .*txt file, but it fails to open that *.txt file if I use Shell(myapp.exe) in vb to start myapp.exe.

    Now if I double click on the myapp.exe then it has no problems with reading file contents.

    so as you see this is "magic" again....

    any questions or ideas what may causing it?

    M.V.B. 2008 Express Edition

  2. #2
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008]Processstart Q

    Are there any errors encountered? And it would be good to see the code that opens myapp.exe.
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    74

    Re: [2008]Processstart Q

    This is how I open myapp.exe & it gives no error, it does start the myapp.exe & then myapp.exe errors if i use this code to launch it.
    Code:
                Dim _process = My.Computer.FileSystem.CurrentDirectory & "\myapp.exe"
                Dim objProcess As System.Diagnostics.Process
                Try
                    objProcess = New System.Diagnostics.Process()
                    objProcess.StartInfo.FileName = _process
                    objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
                    objProcess.Start()
    
                    'Wait until the process passes back an exit code 
                    objProcess.WaitForExit()
    
                    'Free resources associated with this process
                    objProcess.Close()
                Catch
                    MessageBox.Show("Could not start process " & _process, "Error")
                End Try

    M.V.B. 2008 Express Edition

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [2008]Processstart Q

    Where exactly is the TXT file? Is it in the same folder as myapp.exe? Where exactly is myapp.exe? Is it in the same folder as the VB app you're using to start it?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008]Processstart Q

    It seems to me that My.Computer.FileSystem.CurrentDirectory may be the cause of the problem. Try debugging and see what it's value is.
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    74

    Re: [2008]Processstart Q

    I also attached the folder structure:

    so basically [I]WindowsApplication1\WindowsApplication1\bin\Debug\WindowsApplication1.exe[/I] should launch \config\_deadlinkscheck.exe & \config\_deadlinkscheck.exe should read first line of text from _deadlinks_temp

    now this all works fine, if I double click the _deadlinkscheck.exe , but if I use VB to launch _deadlinkscheck.exe then i get error

    Debugger showed correct dir where the files
    Attached Files Attached Files

    M.V.B. 2008 Express Edition

  7. #7
    Frenzied Member
    Join Date
    Mar 2005
    Location
    Sector 001
    Posts
    1,577

    Re: [2008]Processstart Q

    Set the working directory of the startinfo to the folder where your exe is. objProcess.StartInfo.WorkingDirectory
    VB 2005, Win Xp Pro sp2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width