Howard, based on your advice, my basic code now works as I wanted. I got it working without needing xpzed/win32.
Thank you again. --rob solomon On Sunday, June 26, 2022 at 3:44:01 PM UTC-4 Howard C. Shaw III wrote: > > > https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setforegroundwindow > > "The system restricts which processes can set the foreground window. A > process can set the foreground window only if one of the following > conditions is true: > > - The process is the foreground process. > - The process was started by the foreground process. > - The process received the last input event. > - There is no foreground process. > - The process is being debugged. > - The foreground process is not a Modern Application or the Start > Screen. > - The foreground is not locked (see LockSetForegroundWindow > > <https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-locksetforegroundwindow> > ). > - The foreground lock time-out has expired (see > *SPI_GETFOREGROUNDLOCKTIMEOUT* in SystemParametersInfo > > <https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-systemparametersinfoa> > ). > - No menus are active. > > An application cannot force a window to the foreground while the user is > working with another window. Instead, Windows flashes the taskbar button of > the window to notify the user." > > > https://stackoverflow.com/questions/19136365/win32-setforegroundwindow-not-working-all-the-time > > This is more of a Windows API question than a Golang question, so you > might do better to direct your questions to a Windows forum. The second > link above does describe a workaround involving AttachThreadInput. I'm not > sure if w32 has that function mapped or not - if not, you can try > https://pkg.go.dev/github.com/xpzed/win32 > > Good luck! > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/bf5e2abb-856b-46f1-8fa0-24c434902f91n%40googlegroups.com.