You can use GetMessage/PeekMessage to read out what message was/is sent to the window. For this example, you need user32.decls declarations that are in the commented lines at the start of the code:
You could also use BlitzClose.dll, from here:
http://www.blitzbasic.com/Community/posts.php?topic=44032
;.lib "user32.dll" ; ;api_GetMessage% (lpMsg*, hwnd%, wMsgFilterMin%, wMsgFilterMax%) : "GetMessageA" ;api_PeekMessage% (lpMsg*, hwnd%, wMsgFilterMin%, wMsgFilterMax%, wRemoveMsg%) : "PeekMessageA" ; ;create temp. bank b = CreateBank(8 * 4) hwnd = SystemProperty$("apphwnd") Repeat ;get incoming messages in range $10 to $10 ;api_PeekMessage(b, hwnd, $10, $10) api_PeekMessage(b, hwnd, $10, $10, 1) ;hwnd sender b1 = PeekInt(b, 0) ;message number b2 = PeekInt(b, 4) ;parameter 1 b3 = PeekInt(b, 8) ;parameter 2 b4 = PeekInt(b, 16) ;WM_CLOSE If b2 And $10 = $10 Then Exit ;some rnd number Cls Text 0, 0, Rand($FFFFFF) Forever FreeBank b Print "fading.." Delay 800 RuntimeError "okay" End
You could also use BlitzClose.dll, from here:
http://www.blitzbasic.com/Community/posts.php?topic=44032