Creates a stdWindow object from the Desktop. This object is usually used in order to enumerate over all open windows.
Dim window as stdWindow
For each window in stdWindow.CreateFromDesktop.children
Debug.Print window.name
nextCreates a stdWindow object from a supplied hwnd. It is unlikely this function will be needed unless you already have an hwnd from a different library.
Dim window as stdWindow
set window = stdWindow.CreateFromHwnd(Application.Hwnd)Creates a stdWindow for the window underneath a supplied point.
With MouseGetPos()
set window = stdWindow.Create(.x, .y)
End WithCreates a stdWindow object for a supplied IUnknown object which implements either IOleWindow, IInternetSecurityMgrSite or IShellView. Uses shell API's IUnknown_GetWindow function internally. Useful for obtaining the window object of a UserForm object.
Dim uf as UserForm1: set uf = new UserForm1
uf.show false
With stdWindow.CreateFromIUnknown(uf)
.resizable = true
End WithCreates a stdWindow object which represents the currently open windows context menu (right-click menu).
stdAcc.CreateFromHwnd(stdWindow.CreateFromContextMenu.hwnd).children(1).DoDefaultAction- Get handle() as LongPtr
- Get hDC() as LongPtr
- Get Exists as Boolean
- Get/Let Visible() as Boolean
- Get/Let State() as EWndState 'Normal,Minimised,Maximised
- Get IsFrozen() as Boolean
- Get/Let Caption() as string
- Get Class() as string
- Get RectClient() as Long()
- Get/Let RectWindow() as Long()
- Get/Let X() as Long
- Get/Let Y() as Long
- Get/Let Width() as Long
- Get/Let Height() as Long
- Get ProcessID() as long
- Get ProcessName() as string
- Get/Set Parent() as stdWindow
- Get AncestralRoot() as stdWindow
- Get/Let Style() as Long
- Get/Let StyleEx() as Long
- Get/Let UserData() as LongPtr
- Get/Let WndProc() as LongPtr
- Get/Let Resizable() as Boolean
- Get Children() as Collection
- Get Descendents() as Collection
- Get/Let AlwaysOnTop() as Boolean
- SetHook(idHook, hook, hInstance, dwThreadID) as LongPtr
- Redraw()
- SendMessage(wMsg, wParam, lParam)
- PostMessage(wMsg, wParam, lParam)
- SendMessageTimeout(wMsg, wParam, lParam, TimeoutMilliseconds)
- ClickInput(x?, y?, Button?)
- ClickEvent(x?, y?, Button?, isDoubleClick?, wParam?)
- SendKeysInput(sKeys, bRaw?, keyDelay?)
- SendKeysEvent(sKeys, bRaw?, keyDelay?)
- Show()
- Hide()
- Maximize()
- Minimize()
- Activate()
- Close()
- FindFirst(query)
- FindAll(query)
- Screenshot()
- protInit(Byval hwnd as Longptr/Long)
- protGetNextDescendent(stack, DFS, Prev) as stdWindow
- protGetLookups()
This feature is unimplemented and thus this section will be mostly developer docs
In an ideal world this library would work on all operating systems. The library is definitely possible to implement on all operating systems however currently I mostly lack the time to build and test it on all OSes.
The implementation details of implementing this library on Mac OS X involve use of either ObjC directly (via Obj C runtime C API), or use of a JXA daemon which accesses the System Events application. For example, looping through all windows (via Desktop window) can be done with:
Application("System Events").processes().filter(e=>e.windows().length > 0)which returns
[
Application("System Events").applicationProcesses.byName("Terminal"),
Application("System Events").applicationProcesses.byName("Microsoft Excel"),
Application("System Events").applicationProcesses.byName("TextEdit"),
Application("System Events").applicationProcesses.byName("GitHub Desktop"),
Application("System Events").applicationProcesses.byName("Activity Monitor"),
Application("System Events").applicationProcesses.byName("Google Chrome")
]There might have to be some abstractions cross platform and some methods may be system specific. however