Let's asume I have an application than can be written -or not- with FWH. I know that with TWCapture() I can take some control of it (hiding, maximizing, even changing dimensions of the app. window...)
However: Is there any way than allows me to get a list of all the objets (controls) present in the window. Specifically, I would like to be able to retrieve a list such as {oBtn1, oBtn2, oGet1, oListBox1, oGet2...}?
The idea is to be able to read the coordinates of each control and, eventually, the contens of the Gets: oGet1:VarGet(), oGet1:nTop etc...
Anybody could provide a simple example of how to do it?
Thanks a lot in advance
Rafael
Question about CaptureWindow()
- Rafael Clemente
- Posts: 365
- Joined: Sat Oct 08, 2005 7:59 pm
- Location: Barcelona, Spain
-
- Posts: 142
- Joined: Sun Oct 09, 2005 10:59 am
- Rafael Clemente
- Posts: 365
- Joined: Sat Oct 08, 2005 7:59 pm
- Location: Barcelona, Spain
Frank:
Thanks for your answer but I must be doing something wrong. Part of my code:
oWnd := TWCapture():New("MyMainWnd") // "MyMainWindow" is a FWH application whose App class is a TWindow()
oWnd:Say(20, 20, "Hello", CLR_YELLOW, CLR_RED, oFont, .T., .F.) // It paints "Hello", therefore, oWnd is properly captured
? LEN(oWnd:aControls) --->> Error BASE/1111 Argument error: LEN
Args:
[ 1] = U
Can you suggest something?
Thks
Rafael
Thanks for your answer but I must be doing something wrong. Part of my code:
oWnd := TWCapture():New("MyMainWnd") // "MyMainWindow" is a FWH application whose App class is a TWindow()
oWnd:Say(20, 20, "Hello", CLR_YELLOW, CLR_RED, oFont, .T., .F.) // It paints "Hello", therefore, oWnd is properly captured
? LEN(oWnd:aControls) --->> Error BASE/1111 Argument error: LEN
Args:
[ 1] = U
Can you suggest something?
Thks
Rafael
Rafael Clemente wrote:Frank:
Thanks for your answer but I must be doing something wrong. Part of my code:
oWnd := TWCapture():New("MyMainWnd") // "MyMainWindow" is a FWH application whose App class is a TWindow()
oWnd:Say(20, 20, "Hello", CLR_YELLOW, CLR_RED, oFont, .T., .F.) // It paints "Hello", therefore, oWnd is properly captured
? LEN(oWnd:aControls) --->> Error BASE/1111 Argument error: LEN
Args:
[ 1] = U
Can you suggest something?
Thks
Rafael
Then you need the function
oWndFromhWnd( hWnd )
With the handle you can get the object of the window.
Regards
Juan Carlos Salinas Ojeda
México. D.F.
-------------------------------------------------
México. D.F.
-------------------------------------------------
- Rafael Clemente
- Posts: 365
- Joined: Sat Oct 08, 2005 7:59 pm
- Location: Barcelona, Spain
Juan Carlos:
I'am affraid I do not fully understand four suggestion. In me example, oWnd is the objeto to the captured window and I have enough control over it as to be able to write something with the Say("Hello") instruction.
Anyhow, I tried your suggestion:
Obviously, there is something wrong. Can you tell me how to do it?
Thanks
Rafael
I'am affraid I do not fully understand four suggestion. In me example, oWnd is the objeto to the captured window and I have enough control over it as to be able to write something with the Say("Hello") instruction.
Anyhow, I tried your suggestion:
Code: Select all
oWnd := TWCapture():New( cTitle )
hWnd := oWnd:hWnd
? oWnd, hWnd // "Object" and a lon number. Seems Ok
oW := oWndFromhWnd(hWnd)
? oW // Nil
? LEN(oW:aControls()) // Error, of course
Thanks
Rafael
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Rafael,
oWndFromhWnd(hWnd) will just work for created windows in FWH.
If the window is from another application, not created with FWH, once you have its hWnd you may get each control doing:
oWndFromhWnd(hWnd) will just work for created windows in FWH.
If the window is from another application, not created with FWH, once you have its hWnd you may get each control doing:
Code: Select all
local hCtrl := GetWindow( hWnd, GW_CHILD )
while hCtrl != 0
hCtrl = GetWindow( hCtrl, GW_HWNDNEXT )
...
end
- Rafael Clemente
- Posts: 365
- Joined: Sat Oct 08, 2005 7:59 pm
- Location: Barcelona, Spain