Get location and size of open windows?

12padams

Well-known member
Joined
Feb 19, 2010
Messages
48
Programming Experience
Beginner
Lets just say you were trying to make an alternative window manager for the system so you made a borderless template form and designed your own buttons, title bar and so on and had the center of the form completely transparent for other windows behind it to "fit inside it" (really just sit behind it).

That's the easy part but what about detecting the locations of all windows currently open outside your application. For example lets say the user was running firefox, paint and windows media player. How would I simply detect all windows currently open and automatically put and size the template windows around them?

Here is some Pseudocode I've made that I wish existed but I know it's much more complicated than this:
VB.NET:
  Public Sub setupoverlaywindows()
        For Each Windows.Forms.Application As syswindow
            Dim overwindow As New template
            overwindow.FormBorderStyle = FormBorderStyle.None
            overwindow.Location = New Point(syswindow.location.x, syswindow.location.y)
            overwindow.Size = New Size(syswindow.width, syswindow.height)
            overwindow.lbtitletext = overwindow.titletext
        Next
    End Sub

Then comes problem 2... Making those templates link actions to certain windows such as the close button on the template closing the appropriate window it is wrapping around or the titlebar of the template moving the window it is meant to be linked to.

Is there anyway I do this?
 
Back
Top