What bone-head thing did I miss this time?
#5
This is a very dirty way of doing this but here, @Pete :

Code: (Select All)
Declare Dynamic Library "user32"
    Sub ShowWindow (ByVal hWnd As _Offset, Byval nCmdShow As Long)
End Declare

title$ = "Set Window Active Test"
_Title title$
_Delay .1

Do
    hwnd%& = _WindowHandle
Loop Until hwnd%&


Do
    _Limit 10
    If _WindowHasFocus = 0 Then
        _ScreenIcon
        ShowWindow hwnd%&, 1
    End If
    Print hwnd%&
    Sleep 4
    If Len(InKey$) Then End
Loop

Basically, I'm checking if the window has focus. If it doesn't, I'm forcing the focus back to the window by minimizing it with ScreenIcon and then maximizing it with ShowWindow. The stuff like SetActiveWindow, SetForegroundWindow, etc are all buggy as hell and don't work half the time and no one ever has a good explanation why. Hope this helps you at least a little, Pete.
Ask me about Windows API and maybe some Linux stuff
Reply


Messages In This Thread
RE: What bone-head thing did I miss this time? - by SpriggsySpriggs - 10-29-2022, 01:28 AM



Users browsing this thread: 9 Guest(s)