mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
fix program plugin doesn't work in XP issue.
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Microsoft.Win32;
|
||||
@@ -27,6 +28,12 @@ namespace WinAlfred.Plugin.System
|
||||
|
||||
List<Program> installedList = new List<Program>();
|
||||
|
||||
|
||||
[DllImport("shell32.dll")]
|
||||
static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner,[Out] StringBuilder lpszPath, int nFolder, bool fCreate);
|
||||
const int CSIDL_COMMON_STARTMENU = 0x16; // \Windows\Start Menu\Programs
|
||||
const int CSIDL_COMMON_PROGRAMS = 0x17;
|
||||
|
||||
public List<Result> Query(Query query)
|
||||
{
|
||||
if (string.IsNullOrEmpty(query.RawQuery) || query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List<Result>();
|
||||
@@ -64,7 +71,10 @@ namespace WinAlfred.Plugin.System
|
||||
public void Init(PluginInitContext context)
|
||||
{
|
||||
indexDirectory.Add(Environment.GetFolderPath(Environment.SpecialFolder.Programs));
|
||||
indexDirectory.Add(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\Microsoft\Windows\Start Menu\Programs");
|
||||
|
||||
StringBuilder commonStartMenuPath = new StringBuilder(560);
|
||||
SHGetSpecialFolderPath(IntPtr.Zero, commonStartMenuPath, CSIDL_COMMON_PROGRAMS, false);
|
||||
indexDirectory.Add(commonStartMenuPath.ToString());
|
||||
|
||||
GetAppFromStartMenu();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user