Shell() isnt working

HandBrake for Windows support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
siromega
Posts: 36
Joined: Mon Jul 02, 2007 5:06 am

Shell() isnt working

Post by siromega »

I downloaded the handbrake UI for windows and for some reason, whenever it was supposed to launch the CLI nothing would happen. I downloaded the source and looked at it, and for some reason whenever the system called Shell(), it wouldnt fire. Just go on to the next line of code. No exceptions were fired, etc. Weird.

I was able to work around it using System.Diagnostic.Process and firing off the process that way...

Code: Select all

Dim params As String = "your parameters here"
Dim proc As New System.Diagnostics.Process
proc = System.Diagnostics.Process.Start("""" + ApplicationPath + "\hbcli.exe""", params )
If I needed to wait until the process finished, I would just use proc.WaitForExit().

I thought I would post it here because it took me about an hour to figure out and may be of use to the developers.
User avatar
s55
HandBrake Team
Posts: 9850
Joined: Sun Dec 24, 2006 1:05 pm

Post by s55 »

You will probably find the cli is launching, it's just quiting as soon as its launched due to an error. watch the task bar when you click encode. It may be appearing for around 1 second before closing itself.

Usually the case that you are trying to encode an encrypted source.

Not sure why the above code would make any difference, however if it works better no reason not to switch. It's a tad cleaner anyway.

Well done for finding your way around the code :). It's very.... hacked together quickly :/
User avatar
s55
HandBrake Team
Posts: 9850
Joined: Sun Dec 24, 2006 1:05 pm

Post by s55 »

I'll checking the System.Diagnostics.Process launch method later this evening. Shouldn't really make any difference however it appears to have for you so there may be a reason behind this that I am unaware of.

Code is nicer anyway.

The reason I didn't use it initially was because waitforexit will put the GUI process into a suspended/waiting state which means you can't use it while an encode process is going. (it's too busy watching that process) What I did was simply move the process monitoring onto another thread so the app didn't freeze up in a rather horrible way.
Post Reply