From 07c791331c507334f33fececbfeb68b97c89a44d Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 10 Feb 2014 20:48:08 -0500 Subject: Improved program appearance by setting the correct font, colors, and other styles. --- windows.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'windows.go') diff --git a/windows.go b/windows.go index 6f0f4c1..de6fd6f 100644 --- a/windows.go +++ b/windows.go @@ -134,6 +134,7 @@ const ( var ( createWindowEx = user32.NewProc("CreateWindowExW") destroyWindow = user32.NewProc("DestroyWindow") + enumChildWindows = user32.NewProc("EnumChildWindows") showWindow = user32.NewProc("ShowWindow") ) @@ -166,6 +167,27 @@ func DestroyWindow(hWnd HWND) (err error) { return nil } +type WNDENUMPROC func(hwnd HWND, lParam LPARAM) (cont bool) +type _WNDENUMPROC func(hwnd HWND, lParam LPARAM) int + +func enumChildProc(p WNDENUMPROC) _WNDENUMPROC { + return func(hwnd HWND, lParam LPARAM) int { + if p(hwnd, lParam) { + return TRUE + } + return FALSE + } +} + +// TODO figure out how to handle errors +func EnumChildWindows(hWndParent HWND, lpEnumFunc WNDENUMPROC, lParam LPARAM) (err error) { + enumChildWindows.Call( + uintptr(hWndParent), + syscall.NewCallback(enumChildProc(lpEnumFunc)), + uintptr(lParam)) + return nil +} + // TODO figure out how to handle errors func ShowWindow(hWnd HWND, nCmdShow int) (previouslyVisible bool, err error) { r1, _, _ := showWindow.Call( -- cgit v1.2.3