sancarn / stdVBA

VBA Standard Library - A Collection of libraries to form a common standard layer for modern VBA applications.
MIT License
299 stars 60 forks source link

stdWindow #24

Open sancarn opened 3 years ago

sancarn commented 3 years ago

stdWindow

A class for creating and obtaining window objects, and extracting/controlling properties of them.

Constructors

Properties

Methods

General

sancarn commented 3 years ago

Activate needs to follow this kind of structure:

'Force the window specified by the hWND supplied to the top/front
'@param {ByVal Long} hWND of window to make active
Private Sub ForceWindowToTop(ByVal hwnd As Long)
    Dim lMyPId As Long
    Dim lCurPId As Long
    Dim Handle As Long
    Handle = GetForegroundWindow()
    lMyPId = GetWindowThreadProcessId(hwnd, 0)
    lCurPId = GetWindowThreadProcessId(Handle, 0)

    If Not (lMyPId = lCurPId) Then
        AttachThreadInput lCurPId, lMyPId, True
        SetForegroundWindow hwnd
        AttachThreadInput lCurPId, lMyPId, False
    End If

    If Not (GetForegroundWindow() = hwnd) Then
        SetForegroundWindow hwnd
    End If
End Sub
sancarn commented 6 months ago

Fixed SendKeysInput()