Thanks for reading and any comments you may have.
Context:
- I've been a UI/R&D dev (prototyping, etc.) for over 20 years and just started server/backend development.
- I'm very new to Go - less than 2 months - and have 1) run through much of GoByExample and 2) set up a primitive, working web server on an Amazon EC2 instance.
- I created a UI in another language which serves a HUD (Heads Up Display) for another 3rd party application - a game which spawns multiple windows. (Think multiple poker tables running in multiple windows.)
- I connected the HUD to a Go client I created.
- I use Go to grab OS information because of limitations in the first language.
- I want to continue to use Go because I really enjoy it.
- I'm on a Windows 7 machine.
Goal(s):
- Big picture: When a User moves a window, I want the HUD to move with it.
- To do this I need information about the main windows whos WindowText starts with "Game".
-
The ideal would be something like this:
windows: [ { windowHwnd:hwnd, windowText:windowText, windowX:x, windowY:y, windowWidth:width, windowHeight:height },
.
.
.
{ windowHwnd:hwnd, windowText:windowText, windowX:x, windowY:y, windowWidth:width, windowHeight:height } ]
Steps I've taken:
- I've grabbed and modified github.com/AllenDang/w32 which I think formats syscall for Go.
- When I need an unlisted function from user32.go, I add it.
- Tried using GetForegroundWindow and GetWindowText with result, then GetWindow( hwnd, previous ) to just walkthrough everything
- Read through:
- syscall docs (http://golang.org/pkg/syscall/)
- syscall/dll_windows.go
- syscall/env_windows.go
- syscall/exec_windows.go
- syscall/syscall.go
- syscall/syscall_windows.go
- syscall/syscall_windows_386.go
- syscall/syscall_windows_amd86.go
- syscall/syscall_windows_test.go
- syscall/zsyscall_windows_386.go
- syscall/zsyscall_windows_amd86.go
- syscall/ztypes_windows.go
- syscall/ztypes_windows_386.go
- syscall/ztypes_windows_amd86.go
- Every potential Window Function at Windows Dev Center
- Searched StackExchange, Google, DuckDuckGo
- I can see there's something (TestEnumWindows)
- line 125 in runtime/syscall_windows_test.go (http://golang.org/src/pkg/runtime/syscall_windows_test.go)
- Though this function doesn't exist in syscall_windows_test.go
Questions:
- Better solution? In my ignorance I could easily be overlooking some method like: GiveGeoffreyExactlyWhatHeWants()
- Am I in the right ballpark?
- Is this doable in Go?
- What's the right direction to head?
- Is this something anybody else needs?
It is not clear what you want , but perhaps http://play.golang.org/p/YfGDtIuuBw will help. It uses EnumWindows to find window with a particular title.
Alex