Systemwide event handler through callback
Systemwide event handler through callback
Hi,
I'm searching for possibility for handling events even
1. window is invisible
2. window is small size
3. focus outside of window
When window is visible or Width & Height greater 0 then events handled but not otherwise.
Many thanks for any hints.
I'm searching for possibility for handling events even
1. window is invisible
2. window is small size
3. focus outside of window
When window is visible or Width & Height greater 0 then events handled but not otherwise.
Many thanks for any hints.
Re: Systemwide event handler through callback
If a window is not active, there are no events for the window to process. This is normal and comes from the operating system.
Explain what events should come?
Explain what events should come?
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Systemwide event handler through callback
If a window is not active, there are no events for the window to process. This is normal and comes from the operating system.
Explain what events should come?
If you want to process something in the event loop that is not an event, there are three possibilities.
1: WaitWindowEvent([Timeout]). All events must be filtered.
2: SetWindowTimer
3: Threads
Explain what events should come?
If you want to process something in the event loop that is not an event, there are three possibilities.
1: WaitWindowEvent([Timeout]). All events must be filtered.
2: SetWindowTimer
3: Threads
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Systemwide event handler through callback
Something like this? (just a quick example)
Run the code then press Ctrl+F10 to trigger an event
Run the code then press Ctrl+F10 to trigger an event
Code: Select all
RegisterHotKey_(0, 0, #MOD_CONTROL , #VK_F10)
OpenWindow(0, 100, 100, 140, 80, "", #PB_Window_Invisible)
Repeat
ev=WaitWindowEvent()
If ev=#WM_HOTKEY
OpenWindow(1, 100, 100, 240, 80, "Hotkey detected")
EndIf
Until ev=#PB_Event_CloseWindow
Re: Systemwide event handler through callback
Thanks mk-soft and firace.
The events fired from device driver. Windowed program normally intercepts them throw callback or waitwindowevents. But windowless handling events through thread like a Windows Service becomes impossible.
That's why I create such question and ask for help.
The events fired from device driver. Windowed program normally intercepts them throw callback or waitwindowevents. But windowless handling events through thread like a Windows Service becomes impossible.
That's why I create such question and ask for help.
Re: Systemwide event handler through callback
If the driver sends window messages to your program, see PB-Help SetWindowCallback.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Systemwide event handler through callback
OK when use setwindowcalback with or without windowID in argument but only with visible window.
What about invisible window?
What about invisible window?
Re: Systemwide event handler through callback
Do not include a WindowID.
The SetWindowCallBack is always processed before the PB WaitWindowEvent. This is the direct interface of the messages from the operating system to your programme.
The SetWindowCallBack is always processed before the PB WaitWindowEvent. This is the direct interface of the messages from the operating system to your programme.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Systemwide event handler through callback
Hmm, then what is the problem events not handled on window hidden.
I use SetWndCallback with no windowID and not receive messages. May be I should use WindowTimer to force fire timer messages. Right now I'm unable to test as device should be attached for using driver. How do you think, timer could solve the problem?
I use SetWndCallback with no windowID and not receive messages. May be I should use WindowTimer to force fire timer messages. Right now I'm unable to test as device should be attached for using driver. How do you think, timer could solve the problem?
Re: Systemwide event handler through callback
The short one :
it does not matter whether a window is visible or not. The main thing is that it is defined.
The procedure that you include via SetWindowcallback is always processed first ( before PB gets the events ), so if events arrive from the operating system, you can process them there.
If you specify the window number with SetWindowCallback as a parameter, it applies only to the given window. If not, then the Callback is set for all windows that you have created with PB in this program.
it does not matter whether a window is visible or not. The main thing is that it is defined.
The procedure that you include via SetWindowcallback is always processed first ( before PB gets the events ), so if events arrive from the operating system, you can process them there.
If you specify the window number with SetWindowCallback as a parameter, it applies only to the given window. If not, then the Callback is set for all windows that you have created with PB in this program.
Re: Systemwide event handler through callback
There is only 1 window which is hidden.