Results 1 to 2 of 2

Thread: Hiding then Unhiding a Process

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2009
    Posts
    31

    Hiding then Unhiding a Process

    If you start an exe file by using a Process, you can set certain ProcessStartInfo parameters beforehand, such as CreateNoWindow = True (to hide the process), as in this example:

    Dim myExe As New Process
    Dim p As New System.Diagnostics.ProcessStartInfo
    p.FileName = "cmd.exe" 'starts the cmd console
    p.UseShellExecute = False
    p.CreateNoWindow = True 'hides the cmd window
    myExe.StartInfo = p
    myExe.Start()

    Once a process is started is it possible to 'undo' the hiding, without stopping and restarting the process? I would like to use:

    p.CreateNoWindow = False

    to unhide a hidden console application, but it does not work. Is there a way?

    Rock

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

    Re: Hiding then Unhiding a Process

    As the name suggests, the ProcessStartInfo class contains info for starting a process. It has nothing to do with what happens to that process after it starts, so changing the CreateNoWindow after a process has started obviously can't be useful.

    If what you want to do is possible it would have to be done using the Windows API. You might be able to force windows to create a handle for the main window of process after the fact from its process ID. That's only speculation though. I'd have no idea what function(s) might be able to do that for you.
    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

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