Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 370
  • Last Modified:

What win api functions to use to get data from a specific running window?

Hi all.
Please take a look at this image

this is a screenshot from an online poker site software. My question is:
How to work with this window in the picture and get data from it. Like for example, cards on the board and amount of chips in the middle. I dont need exact code. Just the technique and hopefully a list of api fucntions that can be beneficial(just started to learn api programming with delphi).
By the way these cards are birmap images stored in the game software program files folder and they are named like: 2c.bmp  for 2 clubs and kh.bmp for king hearts.

To make the questions scope more general. How to grap for example the result of a calculation displayed in windows calculator and display it in  edit1.text?

Answering either questions will do. Answering both will be great:)

1 Solution
I guess the game is not within web browser...

First of all, download this tool:

It is always-on-top and will show you information about any specific component on the form.
Let's say you table (just for example):
  TGameRoom -> TPockerTable -> TCardSlot - TCard1
and all you have to do is to use 2 API functions - FindWindow and FindWindowEx. Example

var H : HWND;
  H := FindWindow('TGameRoom', nil);   // Here you take TGameRoom
  if H <> nil then
    H := FindWindowEx(H, nil, 'TPockerTable', nil); // take TPockerTable ....

After you have the Handle of the component you need, you can send messages WM_GETTEXT, WM_SENDTEXT, WM_KEYDOWN, WM_CHAR, WM_LMOUSEDOWN, etc ... using SendMessage or PostMessage API functions.

This is the way to get data from this application, but if the cards are just images ... I am not sure if this can help you...
xo310Author Commented:
thank you very much. this is all i wanted.
Of course the game is not within the browser.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now