... Combine with the LOWORD of wParam to check the activation state (e.g., WA_INACTIVE for background). You may need to inherit a Class TMyWindow from TWindow and implement support for WM_ACTIVATE There are some examples in these forums showing how to inherit and modify Method HandleEvent() https://fivetechsupport.com/forums/viewtopic.php?p=258349&sid=4b8316cfb706cfb5bfa9a662a4a7fb5e#p258349