SetWindowCallback()

Syntax

SetWindowCallback(@ProcedureName() [, #Window])
Description
For experienced programmers only. It's only supported on Microsoft Windows OS.

Normal events should be handled with the regular WaitWindowEvent() or WindowEvent().

This command associates a callback to handle the events of the all open windows. All the events are catched by this callback and can be processed here. To set a callback for a specific window only, the optional parameter can be used to pass the PB window number.

To remove/disable a previous set Callback just call SetWindowCallback(0 [, #Window]).

Warning: this way is lowlevel. Incorrect handling of the messages in the callback can interfere with PB's own message processing.

The callback procedure must have 4 parameters. Here is a sample code to use a callback correctly:
  Procedure MyWindowCallback(WindowID, Message, wParam, lParam)
    Result = #PB_ProcessPureBasicEvents
    ;
    ; you code here
    ;
    ProcedureReturn Result
  EndProcedure

Supported OS

Windows

<- SetActiveWindow() - Window Index - SetWindowColor() ->