-
Dec 8th, 2017, 09:24 AM
#1
Thread Starter
Member
How to open process in minimized state?
Hello,
I'm opening a process in my project to be set as a child window. Currently a timer is dictating when the process should be set (which is fine), however, because the tick interval is quite high (150ms), the window flashes on the screen before being set as child for a brief moment. Is there any way to open it in a minimized state so that it doesn't flash open outside of the panel before the next timer tick (which then sets it as child)?
Also worth noting, the process starts, but the window only opens 15-25 seconds later (it's set as child when it's IsWindow - this is irrelevant I think for my question).
What I've tried:
Code:
p = New Process
With p
.EnableRaisingEvents = True
.StartInfo.FileName = "C:\myFile.exe"
.StartInfo.WindowStyle = ProcessWindowStyle.Minimized
End With
p.Start()
Thanks in advance.
-
Dec 8th, 2017, 09:39 AM
#2
Addicted Member
Re: How to open process in minimized state?
Could you try something like
Code:
Dim P As New ProcessStartInfo("c:\SomeFile.exe")
P.WindowStyle = ProcessWindowStyle.Hidden
Process.Start(P)
Utterly useless, but always willing to help
As a finishing touch god created the dutch
-
Dec 8th, 2017, 10:00 AM
#3
Thread Starter
Member
Re: How to open process in minimized state?
Thanks for the reply,
However, using this code disables the application from even being set as child (for some reason). Also, it doesn't start in a min/hidden state.
Thanks though
-
Dec 8th, 2017, 10:08 AM
#4
Addicted Member
Re: How to open process in minimized state?
Just tried you original code with notepad.exe and that seems to work by me...
Can i ask what kind of file are you trying to start?
Code:
Dim P As Process = New Process
With p
.EnableRaisingEvents = True
.StartInfo.FileName = "C:\Windows\Notepad.exe"
.StartInfo.Windowstyle = ProcessWindowStyle.Minimized
End With
p.Start()
Utterly useless, but always willing to help
As a finishing touch god created the dutch
-
Dec 8th, 2017, 10:28 AM
#5
Thread Starter
Member
Re: How to open process in minimized state?
Hey,
I'm trying to start a .jar file.
Thanks.
-
Dec 8th, 2017, 11:27 AM
#6
Addicted Member
Re: How to open process in minimized state?
Not being formiliar with .jar extensions , i'm going to guess here.... that the file can't be run, it needs to be opend with an other program. something that the process will do.
But now you need the program that opens the .Jar file to be minimized and NOT the .Jar file it self...
I hope this makes sence to you :P
Utterly useless, but always willing to help
As a finishing touch god created the dutch
-
Dec 8th, 2017, 12:34 PM
#7
Thread Starter
Member
Re: How to open process in minimized state?
Originally Posted by Goggy
Not being formiliar with .jar extensions , i'm going to guess here.... that the file can't be run, it needs to be opend with an other program. something that the process will do.
But now you need the program that opens the .Jar file to be minimized and NOT the .Jar file it self...
I hope this makes sence to you :P
It makes sense, however that's definitely not the problem unfortunately
Just a simple solution that I thought of, however I haven't learned how to do this yet, and I'm sure you (or anybody else) will know.
Currently I'm setting the process as child - "If p IsNot Nothing AndAlso IsWindow(p.MainWindowHandle) [Then...]" under a timer tick sub. This is what's causing the issue. Is there a way for me to implement this same code under some other sub which doesn't rely on timer ticks. Because if so, it will be easy for me to implement the SendMessage function to minimize the process when it IsWindow and is something.
Is there any way to do this without a timer tick event? But rather just, in general; when the window's there, do it immediately, rather than relying on the next tick event.
I hope that makes sense, it's difficult for me to describe something that I don't (yet*) understand.
Thanks for your help
-
Dec 8th, 2017, 04:07 PM
#8
Re: How to open process in minimized state?
Could you change the jar file to use JFrame#setState() so that the GUI comes up minimize automatically when it starts up (assuming you're using AWT or Swing)?
-
Dec 8th, 2017, 04:13 PM
#9
Thread Starter
Member
Re: How to open process in minimized state?
Originally Posted by passel
Could you change the jar file to use JFrame#setState() so that the GUI comes up minimize automatically when it starts up (assuming you're using AWT or Swing)?
That's literally a perfect solution, however I don't know any Java and I'd only know how to decompile it. I wouldn't know how to edit it and then recompile it with a "main" class or whatever. I've tried with NetBeans IDE, but it was too damn complex.
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|