thanks for replaysThere is a big difference between a window always being on top and a window always having the focus. Normally, it is not possible for a window to always have the focus because it's the O/S that decides which window should have the focus. That said, if you need the window to see _all_ keystrokes whether or not they are meant for it or another window then you have to install a system-wide keyboard hook.
i made a mistake describing my problem.
really i want 2 things:
1_ window always on top , and with focus, it means, receiving keystrokes.
2_ why code works inside lazarus ide and why fail running alone, even with admin rights.
getmen: using fsSystemStayOnTop, is always on top, but not always with focus.
winni: don't work.
getmen: using fsSystemStayOnTop, is always on top, but not always with focus.It's called ForegroundWindow, which receive input focus. From Microsoft documentation:
The window with which the user is currently working. The system assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads.Put a timer to your form, set Interval to 500, Enabled to true, then create an OnTimer event:
As a side node this is a very abusive approach. As a user, I would delete you application immediately. :)It certainly is very abusive and Windows doesn't cooperate with an application with that attitude. There are a good number of restrictions on setting the foreground window. I have some doubts that a window can continuously and successfully make itself the foreground window.
it fail. i try it before. but why all these diferent codes works fine inside ide?I give up. I seriously doubt that works inside the IDE and fails when your program runs as a standalone application.
i need these behavior because is only one app running and user only will have an numeric keyboard, no mouse, then if a popup or onther thing happens, user will can't solve.Simulate ALT + TAB?
@diego, @440bxQuoteit fail. i try it before. but why all these diferent codes works fine inside ide?I give up. I seriously doubt that works inside the IDE and fails when your program runs as a standalone application.Quotei need these behavior because is only one app running and user only will have an numeric keyboard, no mouse, then if a popup or onther thing happens, user will can't solve.Simulate ALT + TAB?
thanks for replaysThere is a big difference between a window always being on top and a window always having the focus. Normally, it is not possible for a window to always have the focus because it's the O/S that decides which window should have the focus. That said, if you need the window to see _all_ keystrokes whether or not they are meant for it or another window then you have to install a system-wide keyboard hook.
i made a mistake describing my problem.
really i want 2 things:
1_ window always on top , and with focus, it means, receiving keystrokes.
2_ why code works inside lazarus ide and why fail running alone, even with admin rights.
getmen: using fsSystemStayOnTop, is always on top, but not always with focus.
winni: don't work.
Did I misunderstand what you're trying to do ?
I give up. I seriously doubt that works inside the IDE and fails when your program runs as a standalone application.It's possible. From SetForegroundWindow (https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setforegroundwindow): ...A process can set the foreground window only if one of the following conditions is true:...The process is being debugged...