版本比较
摸鱼工具
正文
增加 71 行删除 71 行
48 行未改动4950515253535455565716 行未改动747576777878798081823 行未改动868788899091909192939494959697989910010110210310410510310410510610710710810911011169 行未改动18118218318418518518618718818917 行未改动2072082092102112112122132142152162172182192202212222212222232242252262272252262272282292302313 行未改动23523623723823923924024124224224324424424524624724824924925025125225379 行未改动3333343353363373373383393403414 行未改动3463473483493503503513523533548 行未改动3633643653663673673683693703703713723733733743753763773783783793803813813823833843843853863873873883893903913913923933943943953963973983994004014014024034044054054064074084099 行未改动4194204214224234234244254264274274284294304313 行未改动43543643743843943944044144244325 行未改动4694704714724734734744754764774784794804814824824834844854864864874884894904914924934944944954964974984995005005015025035045045055065075084 行未改动5135145155165175175185195205215215225235245255265275275285295305315325335345355355365375385392 行未改动5425435445455465465475485495505515525535535545555565575585585595605615625635635645655665678 行未改动57657757857958058058158258358358458558658658758858958959059159259259359459559559659759859859960060160260360460560560660760860915 行未改动6256266276286296296306316326336346336346356366376383 行未改动6426436446456466466476486496506516526536546556546556566576586586596606616626626636646656665 行未改动6726736746756766776766776786796806806816826836846 行未改动69169269369469569669569669769869970012 行未改动48 行未改动 return TRUE;}HWND CreateWnd(LPCWSTR WndClassName, LPCWSTR WndName, UINT Width, UINT Height, DWORD Style){ UINT ScrX = GetSystemMetrics(SM_CXSCREEN); UINT ScrY = GetSystemMetrics(SM_CYSCREEN); UINT ScrY = GetSystemMetrics(SM_CYSCREEN); HWND hwnd = CreateWindowExW(WS_EX_LAYERED, WndClassName, WndName, Style, (ScrX - Width) / 2 + 1, (ScrY - Height) / 2 + 1, Width, Height, NULL, NULL, GetModuleHandle(NULL), NULL); ShowWindow(hwnd, SW_SHOW); UpdateWindow(hwnd); return hwnd;16 行未改动 Sleep(2000); hwnd=GetForegroundWindow(); SetWindowLongPtr(hwnd,GWL_EXSTYLE,WS_EX_LAYERED); SetLayeredWindowAttributes(hwnd,RGB(0,0,1),a,LWA_ALPHA); SendMessage(hwnd,WM_PAINT,0,0); SendMessage(hwnd,WM_PAINT,0,0); } if(op==2){ cin>>a; Sleep(2000);3 行未改动 } else if(a==1){ SetWindowPos(hwnd,HWND_NOTOPMOST,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE); } SendMessage(hwnd,WM_PAINT,0,0); } SendMessage(hwnd,WM_PAINT,0,0); } if(op==3){ Sleep(2000); hwnd=GetForegroundWindow(); hwnd=GetForegroundWindow(); SetForegroundWindow(hwnd); keybd_event(18,0,0,0); Sleep(30); keybd_event(115,0,0,0); Sleep(30); keybd_event(115,0,KEYEVENTF_KEYUP,0); Sleep(30); keybd_event(18,0,KEYEVENTF_KEYUP,0); SendMessage(hwnd,WM_CLOSE,0,0); SendMessage(hwnd,WM_DESTROY,0,0); SendMessage(hwnd,WM_QUIT,0,0); SendMessage(hwnd,WM_CLOSE,0,0); SendMessage(hwnd,WM_DESTROY,0,0); SendMessage(hwnd,WM_QUIT,0,0); DestroyWindow(hwnd); } } }/* RegClass(L"DesktopWnd", DesktopWndProc); HWND MainWnd = CreateWnd(L"DesktopWnd", L"DrawDesktop", 600, 500, WS_OVERLAPPEDWINDOW ); //qmsg.push(MSG_SUCCESS, 2000, L"Success");69 行未改动 return TRUE;}HWND CreateWnd(LPCWSTR WndClassName, LPCWSTR WndName, UINT Width, UINT Height, DWORD Style){ UINT ScrX = GetSystemMetrics(SM_CXSCREEN); UINT ScrY = GetSystemMetrics(SM_CYSCREEN); UINT ScrY = GetSystemMetrics(SM_CYSCREEN); HWND hwnd = CreateWindowExW(WS_EX_LAYERED, WndClassName, WndName, Style, (ScrX - Width) / 2 + 1, (ScrY - Height) / 2 + 1, Width, Height, NULL, NULL, GetModuleHandle(NULL), NULL); ShowWindow(hwnd, SW_SHOW); UpdateWindow(hwnd); return hwnd;17 行未改动 if(op==1){ cin>>a; SetWindowLongPtr(hwnd,GWL_EXSTYLE,WS_EX_LAYERED); SetLayeredWindowAttributes(hwnd,RGB(0,0,1),a,LWA_ALPHA); SendMessage(hwnd,WM_PAINT,0,0); SendMessage(hwnd,WM_PAINT,0,0); } if(op==2){ cin>>a; if(a==0){ SetWindowPos(hwnd,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE); } else if(a==1){ SetWindowPos(hwnd,HWND_NOTOPMOST,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE); } SendMessage(hwnd,WM_PAINT,0,0); } SendMessage(hwnd,WM_PAINT,0,0); } if(op==3){ SetForegroundWindow(hwnd); SendMessage(hwnd,WM_CLOSE,0,0); SendMessage(hwnd,WM_DESTROY,0,0); SendMessage(hwnd,WM_QUIT,0,0); SendMessage(hwnd,WM_CLOSE,0,0); SendMessage(hwnd,WM_DESTROY,0,0); SendMessage(hwnd,WM_QUIT,0,0); DestroyWindow(hwnd); }if (op == 4) { // 控制任务栏显示状态 cin >> a; LONG exStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);3 行未改动 exStyle |= WS_EX_TOOLWINDOW; // 工具窗口不显示在任务栏 exStyle &= ~WS_EX_APPWINDOW; // 移除应用窗口样式(避免任务栏显示) SetWindowLongPtr(hwnd, GWL_EXSTYLE, exStyle); cout << "已隐藏任务栏中的窗口图标" << endl; } }
// 强制刷新窗口样式(必须调用,否则样式不生效) SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); } } if(op==5){ cin>>a; if(a==0) ShowWindow(hwnd,SW_SHOW); else ShowWindow(hwnd,SW_HIDE); SendMessage(hwnd,WM_PAINT,0,0); SendMessage(hwnd,WM_PAINT,0,0); } }/* RegClass(L"DesktopWnd", DesktopWndProc); HWND MainWnd = CreateWnd(L"DesktopWnd", L"DrawDesktop", 600, 500, WS_OVERLAPPEDWINDOW );79 行未改动void HideTaskbarIcon(HWND hwnd) { if (hwnd && IsWindow(hwnd)) { LONG style = GetWindowLong(hwnd, GWL_EXSTYLE); SetWindowLong(hwnd, GWL_EXSTYLE, style | WS_EX_TOOLWINDOW); SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); g_bIsHidden = TRUE; g_hTargetWindow = hwnd; printf("窗口已隐藏!\n");4 行未改动void RestoreTaskbarIcon(HWND hwnd) { if (hwnd && IsWindow(hwnd)) { LONG style = GetWindowLong(hwnd, GWL_EXSTYLE); SetWindowLong(hwnd, GWL_EXSTYLE, style & ~WS_EX_TOOLWINDOW); SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); g_bIsHidden = FALSE; g_hTargetWindow = NULL; printf("窗口已恢复!\n");8 行未改动int main() { printf("=== 简单窗口隐藏工具 ===\n"); printf("请先打开要隐藏的窗口,然后按回车键...\n"); getchar();
printf("请在3秒内切换到目标窗口...\n"); Sleep(3000);
// 获取当前活动窗口 HWND hForeground = GetForegroundWindow();
if (hForeground == NULL) { printf("无法获取窗口!\n"); return 1; }
char szTitle[256]; GetWindowTitle(hForeground, szTitle, sizeof(szTitle));
printf("当前窗口: %s\n", szTitle); printf("是否隐藏此窗口?(Y/N): ");
char chChoice; scanf("%c", &chChoice);
if (chChoice == 'Y' || chChoice == 'y') { HideTaskbarIcon(hForeground); printf("\n隐藏成功!按R恢复,按其他键退出: ");
getchar(); // 清除缓冲区的回车 chChoice = getchar();
if (chChoice == 'R' || chChoice == 'r') { RestoreTaskbarIcon(hForeground); } } else { printf("操作取消。\n"); }
printf("按回车退出...\n"); getchar(); getchar(); // 等待按键
return 0;}```# 最终版!!!9 行未改动void HideTaskbarIcon(HWND hwnd) { if (hwnd && IsWindow(hwnd)) { LONG style = GetWindowLong(hwnd, GWL_EXSTYLE); SetWindowLong(hwnd, GWL_EXSTYLE, style | 0x80); // WS_EX_TOOLWINDOW SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SetWindowPos(hwnd, NULL, 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0004 | 0x0020); // SWP flags g_bIsHidden = TRUE; g_hTargetWindow = hwnd;
char title[256]; GetWindowTextA(hwnd, title, sizeof(title)); printf("已隐藏窗口: %s\n", title); }3 行未改动void RestoreTaskbarIcon(HWND hwnd) { if (hwnd && IsWindow(hwnd)) { LONG style = GetWindowLong(hwnd, GWL_EXSTYLE); SetWindowLong(hwnd, GWL_EXSTYLE, style & ~0x80); // 移除WS_EX_TOOLWINDOW SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SetWindowPos(hwnd, NULL, 0, 0, 0, 0, 0x0002 | 0x0001 | 0x0004 | 0x0020); // SWP flags g_bIsHidden = FALSE; g_hTargetWindow = NULL; printf("已恢复窗口\n");25 行未改动 { HWND foreground = GetForegroundWindow(); if (foreground && foreground != GetConsoleWindow()) { HideTaskbarIcon(foreground);
// 显示提示然后隐藏 ShowConsole(); printf("窗口已隐藏!3秒后自动隐藏...\n"); Sleep(3000); HideConsole(); } } break;
case 2: // Ctrl+Alt+S - 恢复窗口 if (g_bIsHidden && g_hTargetWindow) { RestoreTaskbarIcon(g_hTargetWindow);
// 显示提示然后隐藏 ShowConsole(); printf("窗口已恢复!3秒后自动隐藏...\n"); Sleep(3000); HideConsole(); } break;
case 3: // Ctrl+Alt+Q - 退出 PostQuitMessage(0); break; } break;
case WM_DESTROY: PostQuitMessage(0); break;
default: return DefWindowProc(hwnd, msg, wParam, lParam); } return 0;4 行未改动 WNDCLASS wc = {0}; wc.lpfnWndProc = WndProc; wc.hInstance = hInstance; wc.lpszClassName = "HotkeyHider";
if (!RegisterClass(&wc)) { return 1; }
// 创建隐藏的消息窗口 HWND hwnd = CreateWindow("HotkeyHider", NULL, 0, 0, 0, 0, 0, NULL, NULL, hInstance, NULL); if (!hwnd) { return 1; }
// 注册热键 if (!RegisterHotKey(hwnd, 1, MOD_CONTROL | MOD_ALT, 'H') || !RegisterHotKey(hwnd, 2, MOD_CONTROL | MOD_ALT, 'S') || !RegisterHotKey(hwnd, 3, MOD_CONTROL | MOD_ALT, 'Q')) { MessageBox(NULL, "热键注册失败!可能已被其他程序占用。", "错误", MB_ICONERROR); return 1; }
// 显示初始提示 ShowConsole(); printf("=== 隐蔽窗口隐藏器 ===\n"); printf("热键说明:\n");2 行未改动 printf("Ctrl+Alt+Q - 退出程序\n"); printf("程序将在5秒后隐藏到后台...\n"); Sleep(5000); HideConsole();
// 消息循环 MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); }
// 清理 if (g_bIsHidden && g_hTargetWindow) { RestoreTaskbarIcon(g_hTargetWindow); }
UnregisterHotKey(hwnd, 1); UnregisterHotKey(hwnd, 2); UnregisterHotKey(hwnd, 3); DestroyWindow(hwnd);
return 0;}```## 版2(XX.ps1)(双击后点"使用PowerShell运行"):8 行未改动
public class HotkeyHider { [DllImport("user32.dll")] public static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk);
[DllImport("user32.dll")] public static extern bool UnregisterHotKey(IntPtr hWnd, int id);
[DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")] public static extern int GetWindowText(IntPtr hWnd, System.Text.StringBuilder text, int count);
[DllImport("user32.dll")] public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")] public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
public const int GWL_EXSTYLE = -20; public const int WS_EX_TOOLWINDOW = 0x00000080; public const uint SWP_NOMOVE = 0x0002; public const uint SWP_NOSIZE = 0x0001; public const uint SWP_NOZORDER = 0x0004; public const uint SWP_FRAMECHANGED = 0x0020;
public const uint MOD_CONTROL = 0x0002; public const uint MOD_ALT = 0x0001;}"@15 行未改动"隐蔽窗口隐藏器已启动!
热键说明:Ctrl + Alt + H = 隐藏当前窗口Ctrl + Alt + S = 恢复最近隐藏的窗口 Ctrl + Alt + S = 恢复最近隐藏的窗口Ctrl + Alt + Q = 退出程序
程序将在后台运行,通过热键操作。","窗口隐藏工具", "OK", "窗口隐藏工具","OK","Information")
# 热键处理$form.Add_Load({3 行未改动$hiddenWindow = $null
$form.Add_WndProc({ param($sender, $e)
if ($e.Msg -eq 0x0312) { # WM_HOTKEY switch ($e.WParam) { 1 { # Ctrl+Alt+H $hwnd = [HotkeyHider]::GetForegroundWindow() if ($hwnd -ne [IntPtr]::Zero) { $style = [HotkeyHider]::GetWindowLong($hwnd, [HotkeyHider]::GWL_EXSTYLE) [HotkeyHider]::SetWindowLong($hwnd, [HotkeyHider]::GWL_EXSTYLE, $style -bor [HotkeyHider]::WS_EX_TOOLWINDOW) [HotkeyHider]::SetWindowPos($hwnd, [IntPtr]::Zero, 0, 0, 0, 0, [HotkeyHider]::SWP_NOMOVE -bor [HotkeyHider]::SWP_NOSIZE -bor [HotkeyHider]::SetWindowPos($hwnd, [IntPtr]::Zero, 0, 0, 0, 0, [HotkeyHider]::SWP_NOMOVE -bor [HotkeyHider]::SWP_NOSIZE -bor [HotkeyHider]::SWP_NOZORDER -bor [HotkeyHider]::SWP_FRAMECHANGED) $hiddenWindow = $hwnd
$sb = New-Object System.Text.StringBuilder(256) [HotkeyHider]::GetWindowText($hwnd, $sb, $sb.Capacity) $title = $sb.ToString()
# 显示短暂提示 $notify = New-Object System.Windows.Forms.NotifyIcon $notify.Icon = [System.Drawing.SystemIcons]::Information $notify.Visible = $true5 行未改动 2 { # Ctrl+Alt+S if ($hiddenWindow -ne $null) { $style = [HotkeyHider]::GetWindowLong($hiddenWindow, [HotkeyHider]::GWL_EXSTYLE) [HotkeyHider]::SetWindowLong($hiddenWindow, [HotkeyHider]::GWL_EXSTYLE, $style -band (-bnot [HotkeyHider]::WS_EX_TOOLWINDOW)) [HotkeyHider]::SetWindowPos($hiddenWindow, [IntPtr]::Zero, 0, 0, 0, 0, [HotkeyHider]::SWP_NOMOVE -bor [HotkeyHider]::SWP_NOSIZE -bor [HotkeyHider]::SetWindowPos($hiddenWindow, [IntPtr]::Zero, 0, 0, 0, 0, [HotkeyHider]::SWP_NOMOVE -bor [HotkeyHider]::SWP_NOSIZE -bor [HotkeyHider]::SWP_NOZORDER -bor [HotkeyHider]::SWP_FRAMECHANGED) $hiddenWindow = $null
# 显示短暂提示 $notify = New-Object System.Windows.Forms.NotifyIcon $notify.Icon = [System.Drawing.SystemIcons]::Information $notify.Visible = $true6 行未改动 # 退出前恢复窗口 if ($hiddenWindow -ne $null) { $style = [HotkeyHider]::GetWindowLong($hiddenWindow, [HotkeyHider]::GWL_EXSTYLE) [HotkeyHider]::SetWindowLong($hiddenWindow, [HotkeyHider]::GWL_EXSTYLE, $style -band (-bnot [HotkeyHider]::WS_EX_TOOLWINDOW)) [HotkeyHider]::SetWindowPos($hiddenWindow, [IntPtr]::Zero, 0, 0, 0, 0, [HotkeyHider]::SWP_NOMOVE -bor [HotkeyHider]::SWP_NOSIZE -bor [HotkeyHider]::SetWindowPos($hiddenWindow, [IntPtr]::Zero, 0, 0, 0, 0, [HotkeyHider]::SWP_NOMOVE -bor [HotkeyHider]::SWP_NOSIZE -bor [HotkeyHider]::SWP_NOZORDER -bor [HotkeyHider]::SWP_FRAMECHANGED) } $form.Close() }12 行未改动