Problem in executing Exe from Visual Basic.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ratnakar Pedagani

    #1

    Problem in executing Exe from Visual Basic.

    Hi,

    I'm trying to execute a GUI application from visual basic (named
    PathProx.exe). this pathprox.exe is linked to different files that are
    present in the same directory as pathprox. when i'm trying execute
    pathprox.exe directly, i could run the application without any errors,
    but when i'm executing the same using visual basic with the following
    code, pathprox.exe is unable to link with those files. its giving some
    errors. i dont have the source code for pathprox application. can
    anybody suggest me as where i'm going wrong or any solution for this?

    Dim pInfo As PROCESS_INFORMA TION
    Dim sInfo As STARTUPINFO
    Dim sNull As String
    Dim lSuccess As Long
    Dim lRetValue As Long

    sInfo.cb = Len(sInfo)
    lSuccess = CreateProcess(s Null, _

    "C:\RIAAS_Simul ator_RSM\PathPr ox.exe", _
    ByVal 0&, _
    ByVal 0&, _
    1&, _
    NORMAL_PRIORITY _CLASS, _
    ByVal 0&, _
    sNull, _
    sInfo, _
    pInfo)

    lRetValue = TerminateProces s(pInfo.hProces s, 0&)
    lRetValue = CloseHandle(pIn fo.hThread)
    lRetValue = CloseHandle(pIn fo.hProcess)

    Thanking you,
    Regards,
    Ratnakar Pedagani.
  • Steve Gerrard

    #2
    Re: Problem in executing Exe from Visual Basic.


    "Ratnakar Pedagani" <ratnakarp2002@ yahoo.co.in> wrote in message
    news:5b0601e5.0 408201822.1d4db a72@posting.goo gle.com...
    | Hi,
    |
    | I'm trying to execute a GUI application from visual basic (named
    | PathProx.exe). this pathprox.exe is linked to different files that are
    | present in the same directory as pathprox. when i'm trying execute
    | pathprox.exe directly, i could run the application without any errors,
    | but when i'm executing the same using visual basic with the following
    | code, pathprox.exe is unable to link with those files.

    | lSuccess = CreateProcess(s Null, _
    |
    | "C:\RIAAS_Simul ator_RSM\PathPr ox.exe", _
    | ByVal 0&, _
    | ByVal 0&, _

    You may just need to put

    ChDir "C:\RIAAS_Simul ator_RSM"

    before calling CreateProcess.


    Comment

    • Eddie B

      #3
      Re: Problem in executing Exe from Visual Basic.

      How bout this...


      lSuccess = CreateProcess(s Null, _
      "C:\RIAAS_Simul ator_RSM\PathPr ox.exe", _
      ByVal 0&, _
      ByVal 0&, _
      1&, _
      NORMAL_PRIORITY _CLASS, _
      ByVal 0&, _
      "C:\RIAAS_Simul ator_RSM", _
      sInfo, _
      pInfo)





      On 20 Aug 2004 19:22:41 -0700, ratnakarp2002@y ahoo.co.in (Ratnakar
      Pedagani) wrote:
      [color=blue]
      >Hi,
      >
      >I'm trying to execute a GUI application from visual basic (named
      >PathProx.exe ). this pathprox.exe is linked to different files that are
      >present in the same directory as pathprox. when i'm trying execute
      >pathprox.exe directly, i could run the application without any errors,
      >but when i'm executing the same using visual basic with the following
      >code, pathprox.exe is unable to link with those files. its giving some
      >errors. i dont have the source code for pathprox application. can
      >anybody suggest me as where i'm going wrong or any solution for this?
      >
      >Dim pInfo As PROCESS_INFORMA TION
      > Dim sInfo As STARTUPINFO
      > Dim sNull As String
      > Dim lSuccess As Long
      > Dim lRetValue As Long
      >
      > sInfo.cb = Len(sInfo)
      > lSuccess = CreateProcess(s Null, _
      >
      >"C:\RIAAS_Simu lator_RSM\PathP rox.exe", _
      > ByVal 0&, _
      > ByVal 0&, _
      > 1&, _
      > NORMAL_PRIORITY _CLASS, _
      > ByVal 0&, _
      > sNull, _
      > sInfo, _
      > pInfo)
      >
      > lRetValue = TerminateProces s(pInfo.hProces s, 0&)
      > lRetValue = CloseHandle(pIn fo.hThread)
      > lRetValue = CloseHandle(pIn fo.hProcess)
      >
      >Thanking you,
      >Regards,
      >Ratnakar Pedagani.[/color]

      Comment

      Working...