From 3160d814a1a088cfbcbd3c48c02d36273fd56383 Mon Sep 17 00:00:00 2001 From: Jon duSaint Date: Sat, 30 Apr 2022 16:16:25 -0700 Subject: Commit a bunch of old software --- xkill/xkill.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ xkill/xkill.exe | Bin 0 -> 57344 bytes xkill/xkill.ico | Bin 0 -> 1078 bytes 3 files changed, 88 insertions(+) create mode 100644 xkill/xkill.c create mode 100755 xkill/xkill.exe create mode 100644 xkill/xkill.ico (limited to 'xkill') diff --git a/xkill/xkill.c b/xkill/xkill.c new file mode 100644 index 0000000..1ef0527 --- /dev/null +++ b/xkill/xkill.c @@ -0,0 +1,88 @@ +/* xkill.c + * Misnamed program which will kill whatever window is clicked on. + */ + +#include + +HWND me, target; + +LRESULT CALLBACK +MainWindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + POINT pt; + WINDOWPLACEMENT wp; + + switch (uMsg) + { + case WM_CREATE: + SetCapture (me); + break; + case WM_NCPAINT: + case WM_NCACTIVATE: /* prevent painting of nonclient areas */ + return TRUE; + case WM_LBUTTONDOWN: + pt.x = LOWORD (lParam); + pt.y = HIWORD (lParam); + + wp.length = sizeof (WINDOWPLACEMENT); + wp.flags = 0; + wp.showCmd = SW_MINIMIZE; + SetWindowPlacement (me, &wp); + + target = WindowFromPoint (pt); + if (target == NULL) target = GetDesktopWindow (); + SendMessage (target, WM_CLOSE, 0, 0); + SendMessage (target, WM_DESTROY, 0, 0); + SendMessage (target, WM_QUIT, 0, 0); + + wp.length = sizeof (WINDOWPLACEMENT); + wp.flags = 0; + wp.showCmd = SW_MAXIMIZE; + SetWindowPlacement (me, &wp); + + break; + case WM_RBUTTONUP: + PostQuitMessage (0); + break; + case WM_DESTROY: + PostQuitMessage (0); + break; + default: + return DefWindowProc (hWnd, uMsg, wParam, lParam); + } + + return 0; +} + +int WINAPI +WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) +{ + WNDCLASS wc; + MSG msg; + + ZeroMemory (&wc, sizeof (WNDCLASS)); + wc.lpfnWndProc = MainWindowProc; + wc.hInstance = hInst; + wc.hIcon = LoadIcon (hInst, "xkill_icon"); + wc.hCursor = LoadCursor (hInst, "xkill_cursor"); + wc.lpszClassName = "XKILL"; + + RegisterClass (&wc); + + me = CreateWindowEx (WS_EX_TRANSPARENT, "XKILL", "XKill", 0, + 0, -GetSystemMetrics (SM_CYCAPTION), + GetSystemMetrics (SM_CXSCREEN), + GetSystemMetrics (SM_CYSCREEN) + + GetSystemMetrics (SM_CYCAPTION), + NULL, NULL, hInst, NULL); + + ShowWindow (me, nCmdShow); + + while (GetMessage (&msg, NULL, 0, 0)) + { + TranslateMessage (&msg); + DispatchMessage (&msg); + } + + return (int)msg.wParam; +} diff --git a/xkill/xkill.exe b/xkill/xkill.exe new file mode 100755 index 0000000..8181a26 Binary files /dev/null and b/xkill/xkill.exe differ diff --git a/xkill/xkill.ico b/xkill/xkill.ico new file mode 100644 index 0000000..4264318 Binary files /dev/null and b/xkill/xkill.ico differ -- cgit v1.2.3