gpt4 book ai didi

c# - 如何访问 Windows 任务管理器中的 SysListView32 服务选项卡

转载 作者:太空宇宙 更新时间:2023-11-03 16:02:30 25 4
gpt4 key购买 nike

我正在尝试从 Windows 任务管理器中恢复一些项目。使用此代码,我从 Process TAB 中恢复了 SysListView32 句柄:(dlgItem)

IntPtr mainWindowHandle = Process.GetProcessesByName("taskmgr")[0].MainWindowHandle;
Api.WindowPlacement lpwndpl = new Api.WindowPlacement();
lpwndpl.length = Marshal.SizeOf((object) lpwndpl);
Api.GetWindowPlacement(mainWindowHandle, ref lpwndpl);
bool flag1 = lpwndpl.showCmd == 1 || lpwndpl.showCmd == 3;
IntPtr dlgItem = Api.GetDlgItem(Api.FindWindowEx(mainWindowHandle, IntPtr.Zero, (string) null, (string) null), 1009);

如何恢复 SysListView32 服务选项卡的句柄?

我正在使用的一些 API 定义:

internal static class Api
{
public struct Rect
{
private int left;
private int top;
private int right;
private int bottom;
}

public struct Point
{
private int x;
private int y;
}

public struct WindowPlacement
{
public int length;
public int flags;
public int showCmd;
public Api.Point ptMinPosition;
public Api.Point ptMaxPosition;
public Api.Rect rcNormalPosition;
}


[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetWindowPlacement(IntPtr hWnd, ref Api.WindowPlacement lpwndpl);

[DllImport("user32.dll")]
public static extern IntPtr GetDlgItem(IntPtr hDlg, int nIDDlgItem);


[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
}

最佳答案

您必须使用 FindWindowEx,类名 (lpszClass) 等于“#32770”,窗口标题 (lpszWindow) 等于“服务”。子 SysListView32 的 ID 然后是 3504 (0x0000db0)。

这些数据来自 Spy++,在法国 Windows Seven Pro 32 位操作系统上使用。

Task Manager Windows Tree

SysListView32 properties

关于c# - 如何访问 Windows 任务管理器中的 SysListView32 服务选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20701052/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com