{"id":13831272,"url":"https://github.com/t4th/win32-gui-wrapper","last_synced_at":"2025-07-09T13:33:11.287Z","repository":{"id":193015524,"uuid":"152134371","full_name":"t4th/win32-gui-wrapper","owner":"t4th","description":"Experimental win32 gui wrapper in C++","archived":false,"fork":false,"pushed_at":"2025-03-17T09:53:12.000Z","size":34434,"stargazers_count":53,"open_issues_count":0,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-17T10:44:19.467Z","etag":null,"topics":["builder","c","cpp","gui","msvc","native","scintilla","simplegrid","win32","wrapper"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/t4th.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2018-10-08T19:25:15.000Z","updated_at":"2025-03-17T09:53:18.000Z","dependencies_parsed_at":"2023-09-06T11:03:44.860Z","dependency_job_id":"a4f2c229-4178-4823-b20b-389d03b098f8","html_url":"https://github.com/t4th/win32-gui-wrapper","commit_stats":null,"previous_names":["t4th/win32-gui-wrapper"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/t4th/win32-gui-wrapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t4th%2Fwin32-gui-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t4th%2Fwin32-gui-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t4th%2Fwin32-gui-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t4th%2Fwin32-gui-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/t4th","download_url":"https://codeload.github.com/t4th/win32-gui-wrapper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t4th%2Fwin32-gui-wrapper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264468163,"owners_count":23613045,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["builder","c","cpp","gui","msvc","native","scintilla","simplegrid","win32","wrapper"],"created_at":"2024-08-04T10:01:23.459Z","updated_at":"2025-07-09T13:33:11.282Z","avatar_url":"https://github.com/t4th.png","language":"C++","readme":"## Experimental win32 GUI wrapper in C++\nThis is a fun little project that I created around 2011, while I was learning windows native GUI and C++.\nEven though it is just a **prove of concept** learning material that was never supposed to reach 1.0, it is still a good source of win32 API usage examples.\nI remember being the most proud about re-sizing of dynamically created objects and working MDI :).\n\n\n## Goal\nNormally win32 applications are built around sequential message dispatcher.\nInspired by Borland C++ Builder I decided to make C++ event driven wrapper.\n\nFor example:\n\n```c++\nthForm *   form = 0;\nthButton * button = 0\n\nform = new thForm( 0, 0, 0); // Parent, X-position, Y-position\nform-\u003eWidth = 800;\nform-\u003eHeight = 800;\nform-\u003eX = 50;\nform-\u003eY = 50;\nform-\u003eText = L\"Window caption name\";\nform-\u003eSetMenu( menu1);\nform-\u003eOnDestroy = form_onDestroy; // register callback\n\nbutton = new thButton( form, 0, form-\u003eHeight - 30);\nbutton-\u003eWidth = form-\u003eWidth;\nbutton-\u003eHeight = 30;\nbutton-\u003eAnchors.Top = false;\nbutton-\u003eAnchors.Left = true;\nbutton-\u003eAnchors.Right = true;\nbutton-\u003eOnClick = button_onClick;  // register callback\n\nform-\u003eShow();\n```\n\n##### Good\n- It looks nice and is intuitive to use\n- As native GUI it is very responsive\n\n##### Bad\n- C++ API is mixed with native Windows types\n- Only basic features (missing accelerators support, etc.)\n- No good error handling in operator overloads, since I didn't want to use try-catch like Borland C++\n- C++ Builder, QT or other popular frameworks use code generation for static object creation. In my code I had to workaround such problems with dynamic objects and elements, like event callbacks\n\n## TODO\n- ~~architecture overview~~\n- documentation\n- ~~create examples (calculator)~~\n- implement proper error handling\n- ~~change function pointer to std::function~~\n- change raw pointers to smart pointers\n\n## How to use\nProject is using external components which are built into static libraries. Win32 Gui itself is also built into library.\n\nSince this is Windows only, use free Visual Studio Community to open solution file Win32_gui_wrapper.sln:\n- select solution platform (like x64)\n- You **MUST** select example project as startup project for Run (F5) to work (right mouse button on project name in solution explorer, andchoose \"Set as startup project\" in the menu)\n- build (ctrl+shift+b) all and Run (F5)\n- amount of logs is configured with TH_DEBUG_LEVEL in thConfig.h. Set it to 1 for optimal logs and 2 for ALL logs. It can slow application startup due to amount of logs.\n\nNote1: win32 code is using many different static libraries (configuration-properties-\u003elinker-\u003einput):\nWin32_gui.lib;SciLexer.lib;imm32.lib;winmm.lib;Ws2_32.lib\nNote2: the project is using C++17\n\nI have also added project template in **example\\solution_template** which is building code directly from source (not as a lib). This project is not including thObjects based on external source: thRichEdit and thStringGrid.\n\n### Use in your project\nEasiest way is to copy example project and modify.\n\nThe other way is to just build Win32_gui project into static LIB and then adding it with other required dependencies into desired project.\nSimplest window:\n\n```c++\n#include \"thWin32App.h\" // master header of win32 gui wrapper\n\nint main()\n{\n    thWin32App app; // application instance\n    \n    thForm * form = new thForm();\n\n    form-\u003eWidth = 300;\n    form-\u003eHeight = 200;\n    form-\u003eText = TEXT( \"Application Example\"); // window caption\n\n    // register callback needed to quit application when main window is destroyed\n    form-\u003eOnDestroy = []( thObject *, thEventParams_t)\n    {\n        constexpr const thResult_t quit_application = 1;\n        return quit_application;\n    };\n\n    form-\u003eShow();\n\n    app.Run(); // this function exits when main window is destroyed and return 1\n\n    delete form;\n\n    return 0;\n}\n```\n\n## Example\nTo try examples, in Solution Explorer select choosen one as Startup Project and press F5:\n![Alt arch](/doc/doc1.png?raw=true)\n\nOr open **example\\solution_template** to experiment from scratch.\n\n### Basic components\nExample using different kind of windows objects, like: MDI, buttons, combobox, etc.\n![Alt arch](/doc/basic_example.png?raw=true)\n\n### Calculator\nExample int32 calculator.\n![Alt arch](/doc/calc_example.png?raw=true)\n\n### solution_template\nLocated in **example\\solution_template** is an empty, buildable from source template (not a static lib) to experiment upon.\n\n## External\nProgram uses Scintilla as thRichEdit component and SimpleGrid as thStringGrid.\n\n## Architecture\nThis is architecture overview just to have an idea what is going on.\n\nAll visual components are based on thWindow class, which is handling common functionalities.\n![Alt arch](/doc/arch_1.png?raw=true)\n\n![Alt arch](/doc/arch_2.png?raw=true)\n\nthWindow inherit from thObject so all instances created during runtime can be factorized.\n\nThere are also visual components that are not windows:\n![Alt arch](/doc/arch_3.png?raw=true)\n\nAnd there are classes that are not thObjects at all:\n![Alt arch](/doc/arch_6.png?raw=true)\n\nParameters are mostly handled my thParam.\n![Alt arch](/doc/arch_4.png?raw=true)\n\nSome objects though need specialized parameters, for example thListView:\n![Alt arch](/doc/arch_5.png?raw=true)\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft4th%2Fwin32-gui-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ft4th%2Fwin32-gui-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft4th%2Fwin32-gui-wrapper/lists"}