{"id":22514843,"url":"https://github.com/nperovic/guienhancerkit","last_synced_at":"2026-03-11T09:31:33.016Z","repository":{"id":241606084,"uuid":"805984625","full_name":"nperovic/GuiEnhancerKit","owner":"nperovic","description":"Elevate your AHK Gui development with extended methods and properties.","archived":false,"fork":false,"pushed_at":"2024-12-02T05:13:09.000Z","size":76,"stargazers_count":30,"open_issues_count":2,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-09-10T16:51:33.273Z","etag":null,"topics":["ahk","ahk-gui","ahk-library","ahk2","ahkscript","ahkv2","autohotkey","autohotkey-script","autohotkey-v2","dark-mode","dark-theme","gdi","gdi32","gui","subclass","subclassing","win32","window-style","windows"],"latest_commit_sha":null,"homepage":"https://github.com/users/nperovic/projects/5?pane=info","language":"AutoHotkey","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nperovic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"buy_me_a_coffee":"nklprvcp"}},"created_at":"2024-05-26T03:20:20.000Z","updated_at":"2025-09-06T18:43:07.000Z","dependencies_parsed_at":"2024-06-16T02:05:26.215Z","dependency_job_id":"ad38982d-3450-4a76-a7a9-a79ba7af94f1","html_url":"https://github.com/nperovic/GuiEnhancerKit","commit_stats":null,"previous_names":["nperovic/guienhancerkit"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nperovic/GuiEnhancerKit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nperovic%2FGuiEnhancerKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nperovic%2FGuiEnhancerKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nperovic%2FGuiEnhancerKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nperovic%2FGuiEnhancerKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nperovic","download_url":"https://codeload.github.com/nperovic/GuiEnhancerKit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nperovic%2FGuiEnhancerKit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30377273,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T06:09:32.197Z","status":"ssl_error","status_checked_at":"2026-03-11T06:09:17.086Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ahk","ahk-gui","ahk-library","ahk2","ahkscript","ahkv2","autohotkey","autohotkey-script","autohotkey-v2","dark-mode","dark-theme","gdi","gdi32","gui","subclass","subclassing","win32","window-style","windows"],"created_at":"2024-12-07T03:22:24.267Z","updated_at":"2026-03-11T09:31:32.997Z","avatar_url":"https://github.com/nperovic.png","language":"AutoHotkey","funding_links":["https://buymeacoffee.com/nklprvcp"],"categories":[],"sub_categories":[],"readme":"# GuiEnhancerKit\nElevate your AHK Gui development with extended methods and properties. This library provides a set of extended methods and properties to enhance your AutoHotkey Gui development experience.\n\n🌍Other Language: [中文](README_zh-tw.md)  \n\n## Getting Started\n\n### Including the library in your script\n```AUTOIT\n#Requires AutoHotkey v2\n#Include \u003cGuiEnhancerKit\u003e\n```\n\n### Using VSCode's IntelliSence\n\u003e ![image](https://github.com/nperovic/GuiEnhancerKit/assets/122501303/8b7942c1-5805-4c64-b955-d8aa1d782cc0)\n\u003e ![image](https://github.com/nperovic/GuiEnhancerKit/assets/122501303/8decc18c-57e0-47a7-8ee7-ebef7e4845d4)\n\nTo ensure proper functioning of VSCode's IntelliSence, you can:\n1. 替换 `Gui` object with `GuiExt`. (Recommended)\n```CPP\nmyGui := GuiExt(\"-Caption +Resize\")\n```\n2. Annotate the variable type as GuiExt above the line where you create a new Gui object instance.\n```js\n/** @var {GuiExt} myGui */\nmyGui := Gui(\"-Caption +Resize\")\n```\n\n## Features\n\n### `GuiControl.SetRounded(corner := 9)`  \n\u003e ![image](https://github.com/nperovic/GuiEnhancerKit/assets/122501303/0ebff7a5-f3cf-45a3-9059-6bb62f8960f8)  \n\nThis method sets the control's border style to rounded corners. The radius of the rounded corners is set to `9` in this case.  \n```PHP\ntext.SetRounded(9)\n```\n\n### `GuiOrControl.X`/ `GuiOrControl.Y`/ `GuiOrControl.W`/ `GuiOrControl.H`\nThese properties allow you to get or set the Gui or Gui Control's position and size.\n```PHP\n/* Get the current gui position. */\nmyEdit.UpdatePos := ctrl =\u003e (ctrl.Value := \n(\n    \"x: \" myGui.X \"\n    y: \" myGui.Y \"\n    w: \" myGui.W \"\n    h: \" myGui.H\n))\n\nmyGui.OnEvent(\"Size\", Size)\n\n/**\n * @param {GuiExt|Gui} GuiObj \n * @param {Integer} MinMax \n * @param {Integer} Width \n * @param {Integer} Height \n */\nSize(GuiObj, MinMax, Width, Height) {\n    Critical(\"Off\")\n    SetWinDelay(-1), SetControlDelay(-1)\n\n    /* Moving Controls */\n    myEdit.W := text.W := Width - (GuiObj.MarginX*2)\n    myEdit.H := Height - (GuiObj.MarginY*2)\n    text.SetRounded()\n    myEdit.UpdatePos()\n}\n```\n\n### `Gui.OnMessage(Msg, Callback, MaxThreads := 1)`  \n### `GuiControl.OnMessage(Msg, Callback, AddRemove := 1)`\nThis method registers a function or method to be called whenever the Gui or GuiControl receives the specified message. [Learn more](https://github.com/nperovic/GuiEnhancerKit/wiki#onmessage)\n```PHP\nWM_LBUTTONDOWN   := 0x0201\nWM_SETCURSOR     := 0x0020\nWM_MOVING        := 0x0216\n\nmyGui.OnMessage(WM_LBUTTONDOWN, DragWindow)\nmyEdit.OnMessage(WM_SETCURSOR, SetCursor)\nmyGui.OnMessage(WM_MOVING, (*) =\u003e myEdit.UpdatePos())\n\n/**\n * Callback function for `GuiCtrl.OnMessage()`\n * @param GuiCtrlObj \n * @param wParam \n * @param lParam \n * @param msg \n * @returns {Integer} \n */\nDragWindow(GuiCtrlObj, wParam, lParam, msg) {\n    static WM_NCLBUTTONDOWN := 0x00A1\n    PostMessage(WM_NCLBUTTONDOWN, 2,,, GuiCtrlObj is Gui.Control ? GuiCtrlObj.Gui : GuiCtrlObj)\n    return 0\n}\n\n/**\n * Callback function for `GuiCtrl.OnMessage()`\n * @param GuiCtrlObj \n * @param wParam \n * @param lParam \n * @param msg \n * @returns {Integer} \n */\nSetCursor(GuiCtrlObj, wParam, lParam, Msg) {\n    static hCursor := DllCall(\"LoadCursor\", \"ptr\", 0, \"ptr\", 32512)\n    DllCall(\"SetCursor\", \"ptr\", hCursor, \"ptr\")\n    return 0\n}\n```\n\n### `Gui.SetDarkTitle()`\nThis method sets the dark mode title bar for the window if the operating system version supports it.\n```PHP\nmyGui.SetDarkTitle()\n```\n\n### `Gui.SetWindowAttribute(dwAttribute, pvAttribute?)`\nThis method calls the `DwmSetWindowAttribute` function from the dwmapi library to set attributes of a window.\n\u003e Requires Windows 11.  \n\u003e [Learn more on MSDN](https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattribute)  \n\u003e ![image](https://github.com/nperovic/GuiEnhancerKit/assets/122501303/ed1a147e-4dea-402e-917a-028555bafb8c)\n```PHP\n/* To set Rounded Corners for window. */\nmyGui.SetWindowAttribute(33, 2)\n```\n\n### `Gui.SetWindowColor(titleText?, titleBackground?, border?)`\nThis method sets the title bar background color to match the GUI background and removes the window border.\n```PHP\nmyGui.SetWindowColor(, myGui.BackColor, myGui.BackColor)\n```\n\n### `Gui.SetDarkMenu()`\nThis method sets the dark mode context menus.\n```PHP\nmyGui.SetDarkMenu()\n```\n\n### `GuiControl.SetTheme(pszSubAppName, pszSubIdList := \"\")`\nApplies a specified theme to the window through the SetWindowTheme function from the uxtheme library.\n```PHP\n/* This example sets dark mode edit control.*/\nmyEdit.SetTheme(\"DarkMode_Explorer\")\n```\n\n### `GuiOrControl.SendMsg(Msg, wParam := 0, lParam := 0)`\nThis method sends a message to the gui or gui control.\n```PHP\nEN_KILLFOCUS := 0x0200\nmyEdit.SendMsg(EN_KILLFOCUS)\n```\n\n### `GuiExt.RECT(objOrAddress?)`\nCreate a `RECT` structure object that defines a rectangle by the coordinates of its upper-left and lower-right corners. This can be used directly with `DllCall`.\n```php\n/* Get RECT object from DllCall */\nDllCall(\"GetWindowRect\", \"Ptr\", WinExist(\"A\"), \"ptr\", rc := GuiExt.RECT())\nMsgBox(Format(\"{} {} {} {} {} {}\", rc.left, rc.top, rc.right, rc.bottom, rc.Width, rc.Height))\n\n/* Create a RECT object with values preset. */\nrc := GuiExt.RECT({top: 10, bottom: 69})\nMsgBox(Format(\"L{}/ T{}/ R{}/ B{}\", rc.left, rc.top, rc.right, rc.bottom))\n\nmyGui.OnMessage(WM_NCCALCSIZE := 0x0083, NCCALCSIZE)\n\nNCCALCSIZE(guiObj, wParam, lParam, msg) {\n    if !wParam {\n        /* Get the structure object from pointer address. */\n        rc := GuiExt.RECT(lParam)\n        ToolTip(Format(\"L{}/ T{}/ R{}/ B{}\", rc.left, rc.top, rc.right, rc.bottom))\n    }\n}\n```\n\n### `GuiOrControl.GetWindowRect()`\nRetrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in **screen coordinates** that are relative to the upper-left corner of the screen. [Learn more on MSDN](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getwindowrect)\n```py\nrc := myGui.GetWindowRect()\nMsgBox(rc.left \" \" rc.top \" \" rc.right \" \" rc.bottom \" \" rc.Width \" \" rc.Height)\n```\n\n### `GuiOrControl.GetClientRect()`\nRetrieves the coordinates of a window's **client area**. The client coordinates specify the upper-left and lower-right corners of the client area. Because client coordinates are relative to the upper-left corner of a window's client area, the coordinates of the upper-left corner are `(0,0)`. \n```py\nrc := myEdit.GetClientRect()\nMsgBox(rc.left \" \" rc.top \" \" rc.right \" \" rc.bottom \" \" rc.Width \" \" rc.Height)\n```\n\n### `Gui.SetBorderless(border := 6, dragWndFunc := \"\", cxLeftWidth?, cxRightWidth?, cyTopHeight?, cyBottomHeight?)`\nTo create a borderless window with customizable resizing behavior.\nCreating a borderless resizable window with [Mica (Alt)](https://learn.microsoft.com/en-us/windows/apps/design/style/mica#app-layering-with-mica-alt) effect. background.   \n\u003e ![20240530-0455-52 6409216](https://github.com/nperovic/GuiEnhancerKit/assets/122501303/6f3f6474-2218-4f74-86ad-e227c49f8031)\n\n```php\nmyGui := GuiExt(\"-Caption +Resize\")\nmyGui.SetFont(\"cWhite s16\", \"Segoe UI\")\nmyGui.SetDarkTitle()\nmyGui.SetDarkMenu()\nmyGui.OnEvent('Size', Size)\n\nmyGui.BackColor := 0x202020\n\ntext := myGui.Add(\"Text\", \"vTitlebar Backgroundcaa2031 cwhite Center R1.5 0x200 w280\", \"Titlebar Area\")\ntext.SetRounded()\n\n/* Set Mica (Alt) background. (Supported starting with Windows 11 Build 22000.) */\nif (VerCompare(A_OSVersion, \"10.0.22600\") \u003e= 0)\n    myGui.SetWindowAttribute(38, 4)\n\nmyGui.SetBorderless(6, (g, x, y) =\u003e (y \u003c= g['Titlebar'].GetWindowRect().bottom), 500, 500, 500, 500)\n\nmyGui.Show(\"h500\")\n\nSize(g, minmax, width, height) {\n    SetControlDelay(-1)\n    /** Set titlebar's width to fix the gui. */\n    g[\"Titlebar\"].W := (width - (g.MarginX*2))\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnperovic%2Fguienhancerkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnperovic%2Fguienhancerkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnperovic%2Fguienhancerkit/lists"}