Howto get window-position of other running apps

Is there a way to get the position of a window spawned by another running application?

Let’s say for instance, i want my application to retrieve the coordinates from the window of StyledEdit.
Using BRoster, I can get a pointer to the team wich runs StyledEdit. Is there a way I could use this pointer to access the BApplication.CountWindows() and BWindow.Bounds()/Frame()?

I thinks this should be possible, since the appserver knows all about the positions of the windows it displays. I have searched the Bebook and Internet, but I could use some help…


I got one step closer: I have to use a BMessenger.
With a message I can invoke the needed hook fucntions in the appropriate team.

Eventually it was in the BeBook.

For those of you who are interested:
It’s done through scripting. In the bebook is an example covering my exact question. :oops: Here it is…

BMessage message, reply;
BRect result;

// set the command constant
message.what = B_GET_PROPERTY;

// construct the specifier stack
message.AddSpecifier("Frame"); // B_DIRECT_SPECIFIER
message.AddSpecifier("View", 1); // B_INDEX_SPECIFIER
message.AddSpecifier("Window", "egg"); // B_NAME_SPECIFIER

// send the message and fetch the result
BMessenger("application/x-fish").SendMessage(&message, &reply);
reply.FindRect("result", &result) 

Nice thanks for that Mauro.