mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-05-19 11:53:02 +12:00
[BUG] Argument Handling #222
This commit is contained in:
parent
680c093659
commit
f2366c0512
|
@ -9,7 +9,6 @@ namespace SystemTrayMenu.DataClasses
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using IWshRuntimeLibrary;
|
|
||||||
using SystemTrayMenu.Utilities;
|
using SystemTrayMenu.Utilities;
|
||||||
using Menu = SystemTrayMenu.UserInterface.Menu;
|
using Menu = SystemTrayMenu.UserInterface.Menu;
|
||||||
|
|
||||||
|
@ -18,8 +17,6 @@ namespace SystemTrayMenu.DataClasses
|
||||||
private static readonly Icon White50PercentageIcon = Properties.Resources.White50Percentage;
|
private static readonly Icon White50PercentageIcon = Properties.Resources.White50Percentage;
|
||||||
private static readonly Icon NotFoundIcon = Properties.Resources.NotFound;
|
private static readonly Icon NotFoundIcon = Properties.Resources.NotFound;
|
||||||
private static DateTime contextMenuClosed;
|
private static DateTime contextMenuClosed;
|
||||||
private string workingDirectory;
|
|
||||||
private string arguments;
|
|
||||||
private string text;
|
private string text;
|
||||||
private Icon icon;
|
private Icon icon;
|
||||||
|
|
||||||
|
@ -248,7 +245,7 @@ namespace SystemTrayMenu.DataClasses
|
||||||
if (!ContainsMenu &&
|
if (!ContainsMenu &&
|
||||||
(e == null || e.Button == MouseButtons.Left))
|
(e == null || e.Button == MouseButtons.Left))
|
||||||
{
|
{
|
||||||
Log.ProcessStart(TargetFilePathOrig, arguments, false, workingDirectory, true);
|
Log.ProcessStart(TargetFilePathOrig, string.Empty, false, string.Empty, true);
|
||||||
if (!Properties.Settings.Default.StaysOpenWhenItemClicked)
|
if (!Properties.Settings.Default.StaysOpenWhenItemClicked)
|
||||||
{
|
{
|
||||||
toCloseByOpenItem = true;
|
toCloseByOpenItem = true;
|
||||||
|
@ -280,10 +277,6 @@ namespace SystemTrayMenu.DataClasses
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IWshShell shell = new WshShell();
|
|
||||||
IWshShortcut lnk = shell.CreateShortcut(TargetFilePath) as IWshShortcut;
|
|
||||||
arguments = lnk.Arguments;
|
|
||||||
workingDirectory = lnk.WorkingDirectory;
|
|
||||||
TargetFilePath = resolvedLnkPath;
|
TargetFilePath = resolvedLnkPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
// <copyright file="GetDeviceCaps.cs" company="PlaceholderCompany">
|
|
||||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
||||||
// </copyright>
|
|
||||||
|
|
||||||
namespace SystemTrayMenu.DllImports
|
|
||||||
{
|
|
||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// wraps the methodcalls to native windows dll's.
|
|
||||||
/// </summary>
|
|
||||||
public static partial class NativeMethods
|
|
||||||
{
|
|
||||||
public static int Gdi32GetDeviceCaps(IntPtr hdc, int nIndex)
|
|
||||||
{
|
|
||||||
return GetDeviceCaps(hdc, nIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
[DllImport("gdi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
|
||||||
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
|
|
||||||
private static extern int GetDeviceCaps(IntPtr hdc, int nIndex);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,7 +12,6 @@ namespace SystemTrayMenu.DllImports
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static partial class NativeMethods
|
public static partial class NativeMethods
|
||||||
{
|
{
|
||||||
#pragma warning disable SA1600 // Elements should be documented
|
|
||||||
public const uint ShgfiIcon = 0x000000100; // get icon
|
public const uint ShgfiIcon = 0x000000100; // get icon
|
||||||
public const uint ShgfiSYSICONINDEX = 0x000004000; // get system icon index
|
public const uint ShgfiSYSICONINDEX = 0x000004000; // get system icon index
|
||||||
public const uint ShgfiLINKOVERLAY = 0x000008000; // put a link overlay on icon
|
public const uint ShgfiLINKOVERLAY = 0x000008000; // put a link overlay on icon
|
||||||
|
@ -22,16 +21,6 @@ namespace SystemTrayMenu.DllImports
|
||||||
public const uint FileAttributeDirectory = 0x00000010;
|
public const uint FileAttributeDirectory = 0x00000010;
|
||||||
public const uint FileAttributeNormal = 0x00000080;
|
public const uint FileAttributeNormal = 0x00000080;
|
||||||
public const int IldTransparent = 0x00000001;
|
public const int IldTransparent = 0x00000001;
|
||||||
#pragma warning restore SA1600 // Elements should be documented
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// comctl32 ImageList_GetIcon(IntPtr hIcon).
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="hIcon">hIcon.</param>
|
|
||||||
public static void Comctl32ImageListGetIcon(IntPtr hIcon)
|
|
||||||
{
|
|
||||||
_ = DestroyIcon(hIcon);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// comctl32 ImageList_GetIcon(IntPtr himl, int i, int flags).
|
/// comctl32 ImageList_GetIcon(IntPtr himl, int i, int flags).
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
// <copyright file="GetMenuDefaultItem.cs" company="PlaceholderCompany">
|
|
||||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
||||||
// </copyright>
|
|
||||||
|
|
||||||
namespace SystemTrayMenu.DllImports
|
|
||||||
{
|
|
||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// wraps the methodcalls to native windows dll's.
|
|
||||||
/// </summary>
|
|
||||||
public static partial class NativeMethods
|
|
||||||
{
|
|
||||||
public static int User32GetMenuDefaultItem(IntPtr hMenu, bool fByPos, uint gmdiFlags)
|
|
||||||
{
|
|
||||||
return GetMenuDefaultItem(hMenu, fByPos, gmdiFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determines the default menu item on the specified menu
|
|
||||||
[DllImport("user32", SetLastError = true, CharSet = CharSet.Unicode)]
|
|
||||||
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
|
|
||||||
private static extern int GetMenuDefaultItem(IntPtr hMenu, bool fByPos, uint gmdiFlags);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue