Getting properties of non-Xojo windows

I’d like to get the Left, Right, Width and Height properties of a non-Xojo window. I need some other things too to make my app work and I’ve splashed out on Monkeybread’s plugins. I know I can get the title of the active non-Xojo Windows window using the RemoteControlMBS.WinFrontWindowTitle as string - but having got that, I don’t know how to get the properties I want. Can I do that within Xojo - or within MBS? And, incidentally, is there an MBS forum anywhere? There are a lot of interesting methods in the plugins library, but I puzzle a bit about understanding exactly how to use them. I don’t want to post here if it annoys other Xojo users. Thx

Using the Win32 API, you can retrieve the handle of a window with FindWindow. That requires however that you know the class and name of the window.

Once you have the window handle, you can use GetWindowRect to retrieve the RECT structure of the window. The RECT structure contains the information that you are looking for.

Thank you. At the moment I’m confined to using basic Xojo and a bit of MBS - normally I’m a Mac person and I don’t know what a Win 32 API is and since I’d be looking at a “foreign” app’s window on my machine (via the internet) I wouldn’t know how to find out its name or class - only, using MBS, its title. It looks as though this will be harder than I expected.

To clarify, basically, I’m logging on to a remote site and using its software package, downloaded to my Windows 7 machine. It throws up a window and I just want to find out its position and size without haaing to jump through too many hoops.

The Win32 API is the “classic” Windows system API. If the window is on your Windows machine, you should be able to use the API. I gather that the window is on your computer, not on a remote session, correct? ( otherwise this is all moot. you would need to do it all on the remote computer.) You can call the Win32 API functions from a Windows Xojo app. Perhaps the function FindWindowLike will let you get the handle without anything other than the window name. Here is a link to a relevant information page.

It is possible that Christian has plugins that can cycle through the displayed windows on the desktop.

Otherwise you are in for declares.

You may want to buy the “Xojo Declares for Win32” book by Eugene Dakin at

Thanks Louis. Yes, this particular problem involves an app and window on my local machine, not remote, but I can see I am going to have to put some work into this, learning about APIs and declares. I thought that “cross-platform” Xojo and a bit of add-on MBS would sort the problem, but it seems not.

Thanks too, Michel, I’ll check out that book. Seems that the more I want Xojo to do what I want, the more stuff I have to buy :frowning:

Steve, the issue is not with Xojo here. It is with your ambition that goes beyond what usual programming tools can do.

Getting other apps windows is not exactly a common requirement.

Let me see if I understand
You have an app running on YOUR machine (not view remote desktop, not in a vm etc) ?
You can verify that it IS executing locally by starting up Task Manager (either at the Windows cmd prompt or via ctrl-alt-delete & starting task manager)
Regardless of where it came from as long as the app is executing on your machine you can read the windows using the Win32 API (or MBS I presume has this)
Its just a matter of iterating through windows open in all other processes

That’s right, Norman. It’s just that I haven’t yet found anything in MBS which does what you describe and I haven’t yet used the Win32 API, so I am having to read up on that now. What I want my app to do is to read data from the non-Xojo window when it is the front window. I can do that now using MBS, but it is vulnerable to the front window moving or resizing. It would be a lot easier if I could discover the window’s position and size programatically and it sounds as though I can do that without too much pain if I can get to grips with the Win 32 API.

I’ve been looking in the RemoteControlMBS class but I’ve now had an email from Christian Schwarz to tell me that there is a WindowsList class in MBS that should do what I want, so hopefully I can put off diving into the Win32 API for the time being.