Results 1 to 9 of 9

Thread: Process starts but does not display window

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2016
    Posts
    155

    Process starts but does not display window

    I have an application that I am trying to launch another exe from. The second exe does start because you can see it in the task manger but the application window does not appear on the screen? Any help would be appreciated.

    Code:
    Dim p As New ProcessStartInfo("\\gvl02\data\programs\assembly\labels\labels.exe")
    p.WindowStyle = ProcessWindowStyle.Normal
    p.Arguments = filterString
    Process.Start(p)

  2. #2
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Process starts but does not display window

    Before descending down the road of assuming the code is at fault, if you use Windows File Explorer to navigate to the UNC path you've indicated and execute the file manually, does it run as expected (visibly)? Or does it run "hidden" that way as well?

    If it runs normally that way, then you may have to set the .WorkingDirectory property of your "p" object to the UNC path of the .exe file (or, perhaps some other path if appropriate).

    Good luck.

  3. #3
    Lively Member
    Join Date
    Aug 2014
    Posts
    65

    Re: Process starts but does not display window

    Does label.exe even have an normal windowstyle? If not maybe this is the reason you can't see it. You could try to remove that line and see if it works.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Apr 2016
    Posts
    155

    Re: Process starts but does not display window

    If I navigate and run it, it runs as expected. And I did try the Working directory and still same issue and the WindowsState is set to Normal in the labels.exe

  5. #5
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Process starts but does not display window

    Quote Originally Posted by BSWhipp View Post
    If I navigate and run it, it runs as expected. And I did try the Working directory and still same issue and the WindowsState is set to Normal in the labels.exe
    Try it like this,

    Code:
            Dim myProc As Process
            Dim pi As New ProcessStartInfo()
            pi.FileName = "\\gvl02\data\programs\assembly\labels\labels.exe"
            ' pi.FileName = "notepad"
            pi.UseShellExecute = True  ' False ' 
            pi.CreateNoWindow = True   '  False '
            pi.WindowStyle = ProcessWindowStyle.Normal
            pi.Arguments = filterString
    
            myProc = Process.Start(pi)
            myProc.WaitForExit()
    These two can be set differently when trying,

    Code:
            pi.UseShellExecute = True  ' False ' 
            pi.CreateNoWindow = True   '  False '
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Apr 2016
    Posts
    155

    Re: Process starts but does not display window

    Loads the labels.exe the same (No window) and stops the processing of the program that launches it.. Go to be something with the program that is running it. Like it won't allow the window to come up for the external program.

  7. #7
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Process starts but does not display window

    Quote Originally Posted by BSWhipp View Post
    Loads the labels.exe the same (No window) and stops the processing of the program that launches it.. Go to be something with the program that is running it. Like it won't allow the window to come up for the external program.
    Did you set this

    pi.CreateNoWindow

    to false with the same results?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  8. #8
    Lively Member
    Join Date
    Aug 2014
    Posts
    65

    Re: Process starts but does not display window

    It looks like the file is located on a network share. Maybe it is a permision problem. You could try to copy the file to your computer and see if it will run then (as far as posible while not running on the expected location). You could also try to create a batch script and see if it will work then. If so maybe the solution could be to link your program to batch script.

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Apr 2016
    Posts
    155

    Re: Process starts but does not display window

    No, not a permission problem. I changed the code to run notepad and still same issue with notepad. Has to be the application that is calling the my dll that is not allowing it to be seen.

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