I'm trying to get my hands on the coordinates of another programs window.
My code sofar does detect the window, but i can't get any coordinates from where it is displayed.
Yes, I use the droopy lib!
handle=0
Repeat
handle=GetHandle("Another program window")
Until handle<>0
hand$=Str(handle)
MessageRequester("HandleName", hand$)
So what do i do next to get coordinates of the window?
Locate X & Y coordinates of another programs window
Locate X & Y coordinates of another programs window
Currently coding the unbelievable WFS program...
You'll know it, when it gets released...
You'll know it, when it gets released...
-
gnozal
- PureBasic Expert

- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Re: Locate X & Y coordinates of another programs window
Here is an example using API :
Code: Select all
hWnd = FindWindow_(#Null, @"Calculator") ; Find Window
If hWnd
If GetWindowRect_(hWnd, @Coordinates.rect) ; Get coordinates
Debug "X = " + Str(Coordinates\left)
Debug "Y = " + Str(Coordinates\top)
Debug "Width = " + Str(Coordinates\right - Coordinates\left)
Debug "Height = " + Str(Coordinates\bottom - Coordinates\top)
EndIf
EndIfFor free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Re: Locate X & Y coordinates of another programs window
Is there a way to cycle through all windows?
For an example:
I try to get the handle of any windowtitle called:
"This is my window 1.*"
Where * could be any value, so it wil work for future versions.
For an example:
I try to get the handle of any windowtitle called:
"This is my window 1.*"
Where * could be any value, so it wil work for future versions.
Currently coding the unbelievable WFS program...
You'll know it, when it gets released...
You'll know it, when it gets released...
Re: Locate X & Y coordinates of another programs window
You may have a look at the AllWindows-Browser.pb example in the PB-Code-Archiv.Waussie wrote:Is there a way to cycle through all windows?
(I have an improved and much faster version of the linked code on one of my older Backup-Harddrives. So, if you have problems to get the example to work, just shout and I'll see if I can find it.)
[Dynamic-Dialogs] - create complex GUIs the easy way
[DeFlicker] - easily deflicker your resizeable Windows
[WinFX] - Window Effects (incl. 'click-through' Window)
[DeFlicker] - easily deflicker your resizeable Windows
[WinFX] - Window Effects (incl. 'click-through' Window)

