{"id":20248228,"url":"https://github.com/rodrigocfd/windigo","last_synced_at":"2025-10-06T06:13:58.106Z","repository":{"id":37711627,"uuid":"340018259","full_name":"rodrigocfd/windigo","owner":"rodrigocfd","description":"Windows API and GUI in idiomatic Go.","archived":false,"fork":false,"pushed_at":"2025-10-01T19:56:52.000Z","size":3440,"stargazers_count":539,"open_issues_count":1,"forks_count":28,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-10-01T21:23:48.076Z","etag":null,"topics":["bindings","ffi","go","golang","gui","native","win32","windows"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/rodrigocfd/windigo","language":"Go","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/rodrigocfd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-02-18T10:46:06.000Z","updated_at":"2025-10-01T19:56:56.000Z","dependencies_parsed_at":"2023-02-13T04:01:20.976Z","dependency_job_id":"290d289b-f076-469e-9e6e-97d0343f0b09","html_url":"https://github.com/rodrigocfd/windigo","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/rodrigocfd/windigo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigocfd%2Fwindigo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigocfd%2Fwindigo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigocfd%2Fwindigo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigocfd%2Fwindigo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rodrigocfd","download_url":"https://codeload.github.com/rodrigocfd/windigo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigocfd%2Fwindigo/sbom","scorecard":{"id":307320,"data":{"date":"2025-08-11","repo":{"name":"github.com/rodrigocfd/windigo","commit":"03a419027a16e019529c63b010c52ca112581bf8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":10,"reason":"30 commit(s) and 5 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T22:23:59.609Z","repository_id":37711627,"created_at":"2025-08-17T22:23:59.609Z","updated_at":"2025-08-17T22:23:59.609Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278324938,"owners_count":25968429,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["bindings","ffi","go","golang","gui","native","win32","windows"],"created_at":"2024-11-14T09:47:13.571Z","updated_at":"2025-10-06T06:13:58.100Z","avatar_url":"https://github.com/rodrigocfd.png","language":"Go","readme":"[![Go Reference](https://pkg.go.dev/badge/github.com/rodrigocfd/windigo.svg)](https://pkg.go.dev/github.com/rodrigocfd/windigo)\r\n[![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/rodrigocfd/windigo?style=flat-square\u0026color=03a7ed)](https://github.com/rodrigocfd/windigo)\r\n[![MIT License](https://img.shields.io/badge/License-MIT-yellow.svg?label=License\u0026style=flat-square)](https://github.com/rodrigocfd/windigo/blob/master/LICENSE.md)\r\n[![Lines of code](https://tokei.rs/b1/github/rodrigocfd/windigo?label=LoC\u0026style=flat-square)](https://github.com/rodrigocfd/windigo)\r\n\r\n# Windigo\r\n\r\nWin32 API and GUI in idiomatic Go.\r\n\r\nWindigo is designed to be familiar to C/C++ Win32 programmers, using the same concepts, and an API as close as possible to the original Win32 API. This allows most C/C++ Win32 tutorials and examples to be translated to Go.\r\n\r\nNotably, Windigo is written 100% in pure Go – CGo is **not** used, just native syscalls. \r\n\r\n## Install\r\n\r\n```\r\ngo get -u github.com/rodrigocfd/windigo\r\n```\r\n\r\n## Examples\r\n\r\n*In the examples below, error checking is ommited for brevity.*\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003eGUI window\u003c/summary\u003e\r\n\r\n### GUI window\r\n\r\nThe example below creates a window programmatically, and handles the button click. Also, it uses the `minimal.syso` provided in the [_resources](_resources/) folder.\r\n\r\n![Screen capture](example.gif)\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"fmt\"\r\n\t\"runtime\"\r\n\r\n\t\"github.com/rodrigocfd/windigo/co\"\r\n\t\"github.com/rodrigocfd/windigo/ui\"\r\n)\r\n\r\nfunc main() {\r\n\truntime.LockOSThread() // important: Windows GUI is single-threaded\r\n\r\n\tShowMainWindow()\r\n}\r\n\r\n// This struct represents our main window.\r\ntype MyWindow struct {\r\n\twnd     *ui.Main\r\n\tlblName *ui.Static\r\n\ttxtName *ui.Edit\r\n\tbtnShow *ui.Button\r\n}\r\n\r\n// Displays the main window, blocking until it is closed.\r\nfunc ShowMainWindow() int {\r\n\twnd := ui.NewMain( // create the main window\r\n\t\tui.OptsMain().\r\n\t\t\tTitle(\"Hello you\").\r\n\t\t\tSize(ui.Dpi(340, 80)).\r\n\t\t\tClassIconId(101), // ID of icon resource, see _resources folder\r\n\t)\r\n\r\n\tlblName := ui.NewStatic( // create the child controls\r\n\t\twnd,\r\n\t\tui.OptsStatic().\r\n\t\t\tText(\"Your name\").\r\n\t\t\tPosition(ui.Dpi(10, 22)),\r\n\t)\r\n\ttxtName := ui.NewEdit(\r\n\t\twnd,\r\n\t\tui.OptsEdit().\r\n\t\t\tPosition(ui.Dpi(80, 20)).\r\n\t\t\tWidth(ui.DpiX(150)),\r\n\t)\r\n\tbtnShow := ui.NewButton(\r\n\t\twnd,\r\n\t\tui.OptsButton().\r\n\t\t\tText(\"\u0026Show\").\r\n\t\t\tPosition(ui.Dpi(240, 19)),\r\n\t)\r\n\r\n\tme := \u0026MyWindow{wnd, lblName, txtName, btnShow}\r\n\tme.events()\r\n\treturn wnd.RunAsMain()\r\n}\r\n\r\nfunc (me *MyWindow) events() {\r\n\tme.btnShow.On().BnClicked(func() {\r\n\t\tmsg := fmt.Sprintf(\"Hello, %s!\", me.txtName.Text())\r\n\t\tme.wnd.Hwnd().MessageBox(msg, \"Saying hello\", co.MB_ICONINFORMATION)\r\n\t})\r\n}\r\n```\r\n\r\nTo compile the final `.exe` file, run the command:\r\n\r\n```\r\ngo build -ldflags \"-s -w -H=windowsgui\"\r\n```\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003eRegistry access\u003c/summary\u003e\r\n\r\n### Registry access\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"github.com/rodrigocfd/windigo/co\"\r\n\t\"github.com/rodrigocfd/windigo/win\"\r\n)\r\n\r\nfunc main() {\r\n\t// Open a registry key\r\n\r\n\thKey, _ := win.HKEY_CURRENT_USER.RegOpenKeyEx(\r\n\t\t\"Control Panel\\\\Mouse\",\r\n\t\tco.REG_OPTION_NONE,\r\n\t\tco.KEY_READ) // open key as read-only\r\n\tdefer hKey.RegCloseKey()\r\n\r\n\t// Read a single value from this key\r\n\r\n\tregVal, _ := hKey.RegQueryValueEx(\"Beep\") // data can be string, uint32, etc.\r\n\r\n\tif strVal, ok := regVal.Sz(); ok { // try to extract a string value\r\n\t\tprintln(\"Beep is\", strVal)\r\n\t}\r\n\r\n\t// Enumerate all values under this key\r\n\r\n\tnamesVals, _ := hKey.RegEnumValue()\r\n\tfor _, nameVal := range namesVals {\r\n\t\tif str, ok := nameVal.Val.Sz(); ok { // does it contain a string?\r\n\t\t\tprintln(\"Value str\", nameVal.Name, str)\r\n\t\t} else if num, ok := nameVal.Val.Dword(); ok { // does it contain an uint32?\r\n\t\t\tprintln(\"Value int\", nameVal.Name, num)\r\n\t\t} else {\r\n\t\t\tprintln(\"Value other\", nameVal.Name)\r\n\t\t}\r\n\t}\r\n}\r\n```\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003eEnumerating running processes\u003c/summary\u003e\r\n\r\n### Enumerating running processes\r\n\r\nThe example below takes a [process snapshot](https://learn.microsoft.com/en-us/windows/win32/toolhelp/taking-a-snapshot-and-viewing-processes) to list the running processes:\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"github.com/rodrigocfd/windigo/co\"\r\n\t\"github.com/rodrigocfd/windigo/win\"\r\n)\r\n\r\nfunc main() {\r\n\thSnap, _ := win.CreateToolhelp32Snapshot(co.TH32CS_SNAPPROCESS, 0)\r\n\tdefer hSnap.CloseHandle()\r\n\r\n\tprocesses, _ := hSnap.EnumProcesses()\r\n\tfor _, nfo := range processes {\r\n\t\tprintln(\"PID:\", nfo.Th32ProcessID, \"name:\", nfo.SzExeFile())\r\n\t}\r\n\r\n\tprintln(len(processes), \"found\")\r\n}\r\n```\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003eTaking a screenshot\u003c/summary\u003e\r\n\r\n### Taking a screenshot\r\n\r\nThis complex example takes a screenshot using [GDI](https://learn.microsoft.com/en-us/windows/win32/gdi/windows-gdi) and saves it to a BMP file.\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"unsafe\"\r\n\r\n\t\"github.com/rodrigocfd/windigo/co\"\r\n\t\"github.com/rodrigocfd/windigo/win\"\r\n)\r\n\r\nfunc main() {\r\n\tcxScreen := win.GetSystemMetrics(co.SM_CXSCREEN)\r\n\tcyScreen := win.GetSystemMetrics(co.SM_CYSCREEN)\r\n\r\n\thdcScreen, _ := win.HWND(0).GetDC()\r\n\tdefer win.HWND(0).ReleaseDC(hdcScreen)\r\n\r\n\thBmp, _ := hdcScreen.CreateCompatibleBitmap(int(cxScreen), int(cyScreen))\r\n\tdefer hBmp.DeleteObject()\r\n\r\n\thdcMem, _ := hdcScreen.CreateCompatibleDC()\r\n\tdefer hdcMem.DeleteDC()\r\n\r\n\thBmpOld, _ := hdcMem.SelectObjectBmp(hBmp)\r\n\tdefer hdcMem.SelectObjectBmp(hBmpOld)\r\n\r\n\t_ = hdcMem.BitBlt(\r\n\t\twin.POINT{X: 0, Y: 0},\r\n\t\twin.SIZE{Cx: cxScreen, Cy: cyScreen},\r\n\t\thdcScreen,\r\n\t\twin.POINT{X: 0, Y: 0},\r\n\t\tco.ROP_SRCCOPY,\r\n\t)\r\n\r\n\tbi := win.BITMAPINFO{\r\n\t\tBmiHeader: win.BITMAPINFOHEADER{\r\n\t\t\tWidth:       cxScreen,\r\n\t\t\tHeight:      cyScreen,\r\n\t\t\tPlanes:      1,\r\n\t\t\tBitCount:    32,\r\n\t\t\tCompression: co.BI_RGB,\r\n\t\t},\r\n\t}\r\n\tbi.BmiHeader.SetSize()\r\n\r\n\tbmpObj, _ := hBmp.GetObject()\r\n\tbmpSize := bmpObj.CalcBitmapSize(bi.BmiHeader.BitCount)\r\n\r\n\trawMem, _ := win.GlobalAlloc(co.GMEM_FIXED|co.GMEM_ZEROINIT, bmpSize)\r\n\tdefer rawMem.GlobalFree()\r\n\r\n\tbmpSlice, _ := rawMem.GlobalLockSlice()\r\n\tdefer rawMem.GlobalUnlock()\r\n\r\n\t_, _ = hdcScreen.GetDIBits(\r\n\t\thBmp,\r\n\t\t0,\r\n\t\tint(cyScreen),\r\n\t\tbmpSlice,\r\n\t\t\u0026bi,\r\n\t\tco.DIB_COLORS_RGB,\r\n\t)\r\n\r\n\tvar bfh win.BITMAPFILEHEADER\r\n\tbfh.SetBfType()\r\n\tbfh.SetBfOffBits(uint32(unsafe.Sizeof(bfh) + unsafe.Sizeof(bi.BmiHeader)))\r\n\tbfh.SetBfSize(bfh.BfOffBits() + uint32(bmpSize))\r\n\r\n\tfout, _ := win.FileOpen(\r\n\t\t\"C:\\\\Temp\\\\screenshot.bmp\",\r\n\t\tco.FOPEN_RW_OPEN_OR_CREATE,\r\n\t)\r\n\tdefer fout.Close()\r\n\r\n\t_, _ = fout.Write(bfh.Serialize())\r\n\t_, _ = fout.Write(bi.BmiHeader.Serialize())\r\n\t_, _ = fout.Write(bmpSlice)\r\n}\r\n```\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003eComponent Object Model (COM)\u003c/summary\u003e\r\n\r\n### Component Object Model (COM)\r\n\r\nWindigo has full support for C++ [COM](https://learn.microsoft.com/en-us/windows/win32/com/component-object-model--com--portal) objects. The cleanup is performed by a `win.OleReleaser` object, which calls [`Release`](https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-release) on multiple COM objects at once, much like an arena allocator. Every function which produces a COM object requires a `win.OleReleaser` to take care of its lifetime.\r\n\r\nThe example below uses COM objects to display the system native [Open File](https://learn.microsoft.com/en-us/windows/win32/learnwin32/example--the-open-dialog-box) window:\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"github.com/rodrigocfd/windigo/co\"\r\n\t\"github.com/rodrigocfd/windigo/win\"\r\n)\r\n\r\nfunc main() {\r\n\truntime.LockOSThread() // important: Windows GUI is single-threaded\r\n\r\n\t_, _ := win.CoInitializeEx(\r\n\t\tco.COINIT_APARTMENTTHREADED | co.COINIT_DISABLE_OLE1DDE)\r\n\tdefer win.CoUninitialize()\r\n\r\n\treleaser := win.NewOleReleaser() // will release all COM objects created here\r\n\tdefer releaser.Release()\r\n\r\n\tvar fod *win.IFileOpenDialog\r\n\t_ = win.CoCreateInstance(\r\n\t\treleaser,\r\n\t\tco.CLSID_FileOpenDialog,\r\n\t\tnil,\r\n\t\tco.CLSCTX_INPROC_SERVER,\r\n\t\t\u0026fod,\r\n\t)\r\n\r\n\tdefOpts, _ := fod.GetOptions()\r\n\t_ = fod.SetOptions(defOpts |\r\n\t\tco.FOS_FORCEFILESYSTEM |\r\n\t\tco.FOS_FILEMUSTEXIST,\r\n\t)\r\n\r\n\t_ = fod.SetFileTypes([]win.COMDLG_FILTERSPEC{\r\n\t\t{Name: \"Text files\", Spec: \"*.txt\"},\r\n\t\t{Name: \"All files\", Spec: \"*.*\"},\r\n\t})\r\n\t_ = fod.SetFileTypeIndex(1)\r\n\r\n\tif ok, _ := fod.Show(win.HWND(0)); ok { // in real applications, pass the parent HWND\r\n\t\titem, _ := fod.GetResult(releaser)\r\n\t\tfileName, _ := item.GetDisplayName(co.SIGDN_FILESYSPATH)\r\n\t\tprintln(fileName)\r\n\t}\r\n}\r\n```\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003eCOM Automation\u003c/summary\u003e\r\n\r\n### COM Automation\r\n\r\nWindigo has bindings to [`IDispatch`](https://learn.microsoft.com/en-us/windows/win32/api/oaidl/nn-oaidl-idispatch) COM interface and [`VARIANT`](https://learn.microsoft.com/en-us/windows/win32/api/oaidl/ns-oaidl-variant) parameters, allowing you to [invoke](https://learn.microsoft.com/en-us/windows/win32/api/oaidl/nf-oaidl-idispatch-invoke) Automation methods.\r\n\r\nThe example below manipulates an Excel spreadsheet, saving a copy of it:\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"github.com/rodrigocfd/windigo/co\"\r\n\t\"github.com/rodrigocfd/windigo/win\"\r\n)\r\n\r\nfunc main() {\r\n\t_, _ = win.CoInitializeEx(\r\n\t\tco.COINIT_APARTMENTTHREADED | co.COINIT_DISABLE_OLE1DDE)\r\n\tdefer win.CoUninitialize()\r\n\r\n\trel := win.NewOleReleaser()\r\n\tdefer rel.Release()\r\n\r\n\tclsId, _ := win.CLSIDFromProgID(\"Excel.Application\")\r\n\r\n\tvar excel *win.IDispatch\r\n\t_ = win.CoCreateInstance(\r\n\t\trel,\r\n\t\tclsId,\r\n\t\tnil,\r\n\t\tco.CLSCTX_LOCAL_SERVER,\r\n\t\t\u0026excel,\r\n\t)\r\n\r\n\tbooks, _ := excel.InvokeGetIDispatch(rel, \"Workbooks\")\r\n\tfile, _ := books.InvokeMethodIDispatch(rel, \"Open\", \"C:\\\\Temp\\\\foo.xlsx\")\r\n\t_, _ = file.InvokeMethod(rel, \"SaveAs\", \"C:\\\\Temp\\\\foo copy.xlsx\")\r\n\t_, _ = file.InvokeMethod(rel, \"Close\")\r\n}\r\n```\r\n\u003c/details\u003e\r\n\r\n## Architecture\r\n\r\nThe library is divided in four packages:\r\n\r\n| Package | Description |\r\n| - | - |\r\n| [`co`](https://pkg.go.dev/github.com/rodrigocfd/windigo/co) | Native Win32 constants, all typed. |\r\n| [`ui`](https://pkg.go.dev/github.com/rodrigocfd/windigo/ui) | High-level UI windows and controls. |\r\n| [`win`](https://pkg.go.dev/github.com/rodrigocfd/windigo/win) | Native Win32 structs, handles and functions. |\r\n| [`wstr`](https://pkg.go.dev/github.com/rodrigocfd/windigo/wstr) | String and UTF-16 wide string management. |\r\n\r\nPackage dependency:\r\n\r\n```mermaid\r\nflowchart BT\r\n    internal/utl([internal/utl]) --\u003e co\r\n    ui --\u003e win\r\n    win --\u003e internal/dll([internal/dll])\r\n    win --\u003e internal/utl\r\n    win --\u003e wstr\r\n```\r\n\r\n## License\r\n\r\nLicensed under [MIT license](https://opensource.org/licenses/MIT), see [LICENSE.md](LICENSE.md) for details.\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frodrigocfd%2Fwindigo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frodrigocfd%2Fwindigo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frodrigocfd%2Fwindigo/lists"}