aboutsummaryrefslogtreecommitdiff
path: root/xkill
diff options
context:
space:
mode:
authorJon duSaint2022-04-30 16:16:25 -0700
committerJon duSaint2022-04-30 16:16:25 -0700
commit3160d814a1a088cfbcbd3c48c02d36273fd56383 (patch)
treeee703f562c870ee7ea675b8b682a48da2750ecfa /xkill
parent659f12ede69726f46487d6e44aa79f48c2bd2aae (diff)

Commit a bunch of old software

Diffstat (limited to 'xkill')
-rw-r--r--xkill/xkill.c88
-rwxr-xr-xxkill/xkill.exebin0 -> 57344 bytes
-rw-r--r--xkill/xkill.icobin0 -> 1078 bytes
3 files changed, 88 insertions, 0 deletions
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 <windows.h>
+
+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
--- /dev/null
+++ b/xkill/xkill.exe
Binary files differ
diff --git a/xkill/xkill.ico b/xkill/xkill.ico
new file mode 100644
index 0000000..4264318
--- /dev/null
+++ b/xkill/xkill.ico
Binary files differ