mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Fixed bug with startprograms UI not clearing
This commit is contained in:
parent
5b15dd367e
commit
10d387d53b
@ -424,6 +424,7 @@ namespace DisplayMagician
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (CreateProcessWithPriorityAsRestrictedUser(executable, arguments, ProcessUtils.TranslatePriorityToClass(processPriority), out processInfo))
|
if (CreateProcessWithPriorityAsRestrictedUser(executable, arguments, ProcessUtils.TranslatePriorityToClass(processPriority), out processInfo))
|
||||||
|
//if (CreateProcessWithPriority(executable, arguments, ProcessUtils.TranslatePriorityToClass(processPriority), out processInfo))
|
||||||
{
|
{
|
||||||
if (processInfo.dwProcessId > 0)
|
if (processInfo.dwProcessId > 0)
|
||||||
{
|
{
|
||||||
@ -487,6 +488,17 @@ namespace DisplayMagician
|
|||||||
{
|
{
|
||||||
// Start the process using built in process library
|
// Start the process using built in process library
|
||||||
ProcessStartInfo psi = new ProcessStartInfo();
|
ProcessStartInfo psi = new ProcessStartInfo();
|
||||||
|
string extension = Path.GetExtension(executable);
|
||||||
|
if (extension.Equals("com", StringComparison.CurrentCultureIgnoreCase)
|
||||||
|
|| extension.Equals("exe", StringComparison.CurrentCultureIgnoreCase)
|
||||||
|
|| extension.Equals("msi", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
psi.UseShellExecute = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
psi.Verb = "Open";
|
||||||
|
}
|
||||||
psi.FileName = executable;
|
psi.FileName = executable;
|
||||||
psi.Arguments = arguments;
|
psi.Arguments = arguments;
|
||||||
psi.WorkingDirectory = Path.GetDirectoryName(executable);
|
psi.WorkingDirectory = Path.GetDirectoryName(executable);
|
||||||
@ -603,7 +615,7 @@ namespace DisplayMagician
|
|||||||
sInfoEx.StartupInfo.cb = Marshal.SizeOf(sInfoEx);
|
sInfoEx.StartupInfo.cb = Marshal.SizeOf(sInfoEx);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
success = CreateProcess(fileName, cmd.ToString(), ref pSec, ref tSec, false, processFlags, IntPtr.Zero, null, ref sInfoEx, out pInfo);
|
success = CreateProcess(null, cmd.ToString(), ref pSec, ref tSec, false, processFlags, IntPtr.Zero, null, ref sInfoEx, out pInfo);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -613,7 +625,7 @@ namespace DisplayMagician
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
success = CreateProcess(fileName, cmd.ToString(), IntPtr.Zero, IntPtr.Zero, false, processFlags, IntPtr.Zero, null, ref sInfoEx, out pInfo);
|
success = CreateProcess(null, cmd.ToString(), IntPtr.Zero, IntPtr.Zero, false, processFlags, IntPtr.Zero, null, ref sInfoEx, out pInfo);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -646,14 +658,14 @@ namespace DisplayMagician
|
|||||||
|
|
||||||
if (!CreateProcessAsUser(
|
if (!CreateProcessAsUser(
|
||||||
hRestrictedToken,
|
hRestrictedToken,
|
||||||
fileName,
|
null,
|
||||||
cmd.ToString(),
|
cmd.ToString(),
|
||||||
IntPtr.Zero,
|
IntPtr.Zero,
|
||||||
IntPtr.Zero,
|
IntPtr.Zero,
|
||||||
true, // inherit handle
|
true, // inherit handle
|
||||||
0,
|
0,
|
||||||
IntPtr.Zero,
|
IntPtr.Zero,
|
||||||
Path.GetDirectoryName(fileName),
|
null,
|
||||||
ref si,
|
ref si,
|
||||||
out pi))
|
out pi))
|
||||||
{
|
{
|
||||||
|
@ -26,8 +26,8 @@ using System.Resources;
|
|||||||
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
|
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
|
||||||
|
|
||||||
// Version information
|
// Version information
|
||||||
[assembly: AssemblyVersion("2.1.0.269")]
|
[assembly: AssemblyVersion("2.1.0.280")]
|
||||||
[assembly: AssemblyFileVersion("2.1.0.269")]
|
[assembly: AssemblyFileVersion("2.1.0.280")]
|
||||||
[assembly: NeutralResourcesLanguageAttribute( "en" )]
|
[assembly: NeutralResourcesLanguageAttribute( "en" )]
|
||||||
[assembly: CLSCompliant(true)]
|
[assembly: CLSCompliant(true)]
|
||||||
|
|
||||||
|
@ -1663,6 +1663,10 @@ namespace DisplayMagician.UIForms
|
|||||||
spOrder++;
|
spOrder++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flp_start_programs.Controls.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
// Setup the single stop program we're beginning with
|
// Setup the single stop program we're beginning with
|
||||||
if (_shortcutToEdit.StopPrograms is List<StopProgram> && _shortcutToEdit.StopPrograms.Count > 0)
|
if (_shortcutToEdit.StopPrograms is List<StopProgram> && _shortcutToEdit.StopPrograms.Count > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user