Go / Golang Attempt to get window information through a system call. (As in EnumWindows, etc.)

Thanks for reading and any of your comments.

Context:

  • I have been UI / R & D dev (prototyping, etc.) for more than 20 years and have just started working with server / server.
  • I am very new to Go - less than 2 months old - and I 1) go through most of GoByExample and 2) set up a primitive, working web server on an Amazon EC2 instance.
  • I created a user interface in another language that serves the HUD (Heads Up Display) for another third-party application - a game that spawns multiple windows. (Think of multiple poker tables working in multiple windows.)
  • I connected the HUD to the Go client that I created.
  • I use Go to get OS information due to limitations in the first language.
  • I want to keep using Go because I really like it.
  • I am on a Windows 7 machine.

Purpose (s):

  • Large image: when the user moves the window, I want the HUD to move with it.
  • To do this, I need information about the main windows, which WindowText begins with "Game".
  • An 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 } ]
    

The steps I took:

  • I grabbed and modified github.com/AllenDang/w32, which I think format syscall for Go.
    • When I need some function from user32.go, I add it.
  • Tried to use GetForegroundWindow and GetWindowText with the result, then GetWindow (hwnd, previous) to just skip everything
  • Read:
    • syscall docs ( http://golang.org/pkg/syscall/ )
    • System call / dll _windows.go
    • System call / env _windows.go
    • System call / exec _windows.go
    • /syscall.go
    • /syscall _windows.go
    • /syscall _windows_386.go
    • /syscall _windows_amd86.go
    • /syscall _windows_test.go
    • /zsyscall _windows_386.go
    • /zsyscall _windows_amd86.go
    • /ztypes _windows.go
    • /ztypes _windows_386.go
    • /ztypes _windows_amd86.go
  • Windows Dev
  • StackExchange, Google, DuckDuckGo
  • - (TestEnumWindows)

:

  • ? - : GiveGeoffreyExactlyWhatHeWants()
  • ?
  • Go?
  • ?
  • - - ?
+4
1

, , , , http://play.golang.org/p/YfGDtIuuBw . EnumWindows .

+2

All Articles