+ Reply to Thread
Results 1 to 12 of 12

Thread: Question to Windows developers

  1. #1
    Senior Member
    Join Date
    Oct 2004
    Location
    Germany (currently)
    Posts
    423

    Default Question to Windows developers

    A totally Windows noob question. I need to retrieve information about the layout and content of any given Windows application. Would it be possible to get
    • the positions of all buttons
    • a label or some kind of "name" from each button
    • the menu entries
    from a running application in Windows?

    The information has to be somewhere because Windows has to layout the application but how difficult would it be to get it?

    Any hints are appreciated.

    Thanks

  2. #2
    Senior Member
    Join Date
    Jul 2004
    Location
    Calgary, AB
    Posts
    522

    Default GetWnd()

    The answer my friend is blowing in GetWnd()...

  3. #3
    Senior Member
    Join Date
    Oct 2004
    Location
    Germany (currently)
    Posts
    423

    Default

    Thanks for the hint. Would it be a lot work to give me a small snippet on how to retrieve, for example, a list of buttons an application has? Just a few lines to get me started?

    I'm planning to integrate a small dll into my Java code. I'm trying to figure out if I can do this by myself or if should hire someone for that.

    Speaking of: do you know good places to find Windows developer? I know getacoder etc, but I mean more a developer forum like this one here.

  4. #4
    Senior Member
    Join Date
    Aug 2004
    Location
    Sunny Santa Barbara, CA
    Posts
    102

    Default

    Quote Originally Posted by wazoo
    The answer my friend is blowing in GetWnd()...
    some sentences are just waiting to be said,

  5. #5
    Member
    Join Date
    Aug 2005
    Location
    Upstate NY
    Posts
    75

    Default

    Quote Originally Posted by wazoo
    The answer my friend is blowing in GetWnd()...
    I wanted to start a punk rock programmer band in which one of the gimmicks (among many) would be in counting off as 0 1 2 3! instead of 1 2 3 4! Of course fitting in that extra syllable would be a hassle.

  6. #6
    Senior Member
    Join Date
    Jul 2004
    Location
    Calgary, AB
    Posts
    522

    Default

    Quote Originally Posted by Ska Software
    I wanted to start a punk rock programmer band in which one of the gimmicks (among many) would be in counting off as 0 1 2 3! instead of 1 2 3 4! Of course fitting in that extra syllable would be a hassle.
    That is a toughie...maybe count in hex??

    "And an A, B - A, B, C, D!"

    Of course the audience would assume that you're just rambling through the alphabet, but YOU know better..

    Naturally, you'd have to be The Hex Pistols

    @baegsi: Seriously, google GetWnd (and maybe "sample" or "tutorial") and
    it should lead you to what you need to find. I've used it a lot of times, and it IS an easy call. Every control in Windows is a HWND, so once you find one, you can snag all the child controls off of it..

    I think even the MSDN has some sample code in the definition of GetWnd itself...(IIRC)

    hth,

  7. #7
    Moderator
    Join Date
    Jul 2004
    Location
    Zürich, Switzerland
    Posts
    1,966

    Default

    Quote Originally Posted by Ska Software
    I wanted to start a punk rock programmer band in which one of the gimmicks (among many) would be in counting off as 0 1 2 3! instead of 1 2 3 4! Of course fitting in that extra syllable would be a hassle.
    Or even better : zero-zero zero-one, one-zero and one-one!
    Gabriel Gambetta
    Google Zürich - Formerly Mystery Studio

  8. #8
    Senior Member
    Join Date
    Sep 2004
    Location
    Netherlands
    Posts
    849

    Default

    Here is an example of using GetNextWindow().

  9. #9
    Senior Member
    Join Date
    Jul 2004
    Location
    Calgary, AB
    Posts
    522

    Default

    Quote Originally Posted by ggambett
    Or even better : zero-zero zero-one, one-zero and one-one!
    Good one though ggambett. That was funny.

    AddRef, Release, QueryInterface and IUnknown!

    okay okay...This is getting silly.

    Colonel: "Quite agree, quite agree...silly, silly, silly. Right! Get on with it!"

  10. #10
    Administrator
    Join Date
    Aug 2004
    Location
    California
    Posts
    1,769

    Default

    Is this to find the positions of your own buttons in your own window or are you trying to peek into other applications and find their buttons?


    Of course this kind of thing will only work if the buttons in the Windows were created with the standard Windows GUI tools (user.dll). Most games roll their own GUI elements. If you try to enumerate all the buttons in any game I ever worked on you will find none of them have any. They all have things that look like buttons, but they are not anything Windows would know anything about.
    James C. Smith - Producer/Lead Programmer - Costume Chaos, Build in Time, Ricochet Infinity, Big Kahuna Reef, CasualCharts.com

  11. #11
    Senior Member
    Join Date
    Oct 2004
    Location
    Germany (currently)
    Posts
    423

    Default

    Quote Originally Posted by James C. Smith
    Is this to find the positions of your own buttons in your own window or are you trying to peek into other applications and find their buttons?
    I'm looking for the gui layout of other applications. But I'm only interested in actual buttons, not simulated ones.

    (I have to admit that my project is only slighted related to game development , but I decided to post it anyway because here are so many helpful coders. Sorry, I hope that's okay...)

  12. #12
    Senior Member
    Join Date
    Jul 2004
    Location
    Calgary, AB
    Posts
    522

    Default try scanning using GetText

    hmm..

    I think you'll have to sort of hardcode a small hierarchy then to scan through the existing window app to find what you need..

    1. Grab the HWND associated with the window text of the application (ie. "Gamespy" or whatever the heck it would be)..look at the EnumWindows method in the MSDN.

    2. Within THAT HWND you'd cycle through the other child controls.
    Maybe look at EnumChildWindows using the HWND discovered in step 1.

    3. GetWindowText MAY not work when working in step 2 to find the button you want...here's what I saw in the MSDN:
    Code:
    To retrieve the text of a control in another process, send a WM_GETTEXT message directly instead of calling GetWindowText.
    Hth...I've never actually done it, so I hope I'm not misleading you here..this just seems like the most logical approach to me..

    hth

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts