diff options
| author | Jon duSaint | 2022-04-30 16:16:25 -0700 |
|---|---|---|
| committer | Jon duSaint | 2022-04-30 16:16:25 -0700 |
| commit | 3160d814a1a088cfbcbd3c48c02d36273fd56383 (patch) | |
| tree | ee703f562c870ee7ea675b8b682a48da2750ecfa /xkill | |
| parent | 659f12ede69726f46487d6e44aa79f48c2bd2aae (diff) | |
Commit a bunch of old software
Diffstat (limited to 'xkill')
| -rw-r--r-- | xkill/xkill.c | 88 | ||||
| -rwxr-xr-x | xkill/xkill.exe | bin | 0 -> 57344 bytes | |||
| -rw-r--r-- | xkill/xkill.ico | bin | 0 -> 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 Binary files differnew file mode 100755 index 0000000..8181a26 --- /dev/null +++ b/xkill/xkill.exe diff --git a/xkill/xkill.ico b/xkill/xkill.ico Binary files differnew file mode 100644 index 0000000..4264318 --- /dev/null +++ b/xkill/xkill.ico |
