Support Board
Date/Time: Thu, 25 Apr 2024 01:06:11 +0000
Post From: [Programming Help] - Is there a way to detect Sierra program window is not focused?
[2022-05-21 04:08:49] |
User462086 - Posts: 188 |
If you're looking for a way to detect the status of the SC window from outside a custom study then have a look at AutoHotkey & it's functions like 'WinActive'. Otherwise, this is not exactly what you're asking for, but it might help you get started. It detects when the SC window IS focused. 'scHasFocus' returns true when the chart the study is applied to has input focus (hence the SC program window is active & has focus). bool scHasFocus = sc.ChartWindowHandle == GetFocus();
bool wdwIsActive = sc.ChartWindowIsActive; bool chartIsActive = (scHasFocus) && (wdwIsActive); if (chartIsActive) { //do something } GetFocus() "Retrieves the handle to the window that has the keyboard focus, if the window is attached to the calling thread's message queue." https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getfocus |