-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmumu_sub_windows.cmd
More file actions
52 lines (48 loc) · 2.58 KB
/
Copy pathmumu_sub_windows.cmd
File metadata and controls
52 lines (48 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
@echo off
chcp 65001 >nul
setlocal
set "ps=%TEMP%\list_mumu_windows_%RANDOM%.ps1"
>"%ps%" echo Add-Type -TypeDefinition @'
>>"%ps%" echo using System;
>>"%ps%" echo using System.Runtime.InteropServices;
>>"%ps%" echo using System.Text;
>>"%ps%" echo public class MuMuWinLister {
>>"%ps%" echo [DllImport("user32.dll", CharSet = CharSet.Unicode)]
>>"%ps%" echo static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
>>"%ps%" echo delegate bool EnumChildProc(IntPtr hwnd, IntPtr lParam);
>>"%ps%" echo [DllImport("user32.dll")]
>>"%ps%" echo static extern bool EnumChildWindows(IntPtr hWndParent, EnumChildProc lpEnumFunc, IntPtr lParam);
>>"%ps%" echo [DllImport("user32.dll", CharSet = CharSet.Unicode)]
>>"%ps%" echo static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
>>"%ps%" echo [DllImport("user32.dll", CharSet = CharSet.Unicode)]
>>"%ps%" echo static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
>>"%ps%" echo [DllImport("user32.dll")]
>>"%ps%" echo static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
>>"%ps%" echo [StructLayout(LayoutKind.Sequential)]
>>"%ps%" echo struct RECT { public int Left, Top, Right, Bottom; }
>>"%ps%" echo static bool Callback(IntPtr hwnd, IntPtr lParam) {
>>"%ps%" echo var cls = new StringBuilder(256);
>>"%ps%" echo var txt = new StringBuilder(256);
>>"%ps%" echo GetClassName(hwnd, cls, 256);
>>"%ps%" echo GetWindowText(hwnd, txt, 256);
>>"%ps%" echo RECT rc;
>>"%ps%" echo GetWindowRect(hwnd, out rc);
>>"%ps%" echo Console.WriteLine("h=0x{0:X8} ^| class={1,-30} ^| title={2,-30} ^| size={3}x{4}", hwnd.ToInt64(), cls.ToString(), txt.ToString(), rc.Right - rc.Left, rc.Bottom - rc.Top);
>>"%ps%" echo return true;
>>"%ps%" echo }
>>"%ps%" echo public static void List(string parentTitle) {
>>"%ps%" echo IntPtr parent = FindWindow(null, parentTitle);
>>"%ps%" echo if (parent == IntPtr.Zero) { Console.WriteLine("Parent not found: " + parentTitle); return; }
>>"%ps%" echo Console.WriteLine("Parent: 0x{0:X8} ({1})", parent.ToInt64(), parentTitle);
>>"%ps%" echo EnumChildWindows(parent, Callback, IntPtr.Zero);
>>"%ps%" echo }
>>"%ps%" echo }
>>"%ps%" echo '@
>>"%ps%" echo $title = 'MuMu' + [char]0x6A21 + [char]0x62DF + [char]0x5668 + '12'
>>"%ps%" echo [MuMuWinLister]::List($title)
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%ps%"
echo.
echo 临时脚本路径:%ps%
echo.
echo 按任意键退出...
pause >nul