Re: Windows RED button
- Posted by Mario Steele <eumario at trilake.net> Feb 02, 2005
- 418 views
> Anyone know how to trap a click on the red kill button? Okay, the Windows RED button, is actually called the Close Button. Depending on the library you are using, you can trap the Close Event in 2 ways. Win32lib:
procedure onClose_window(integer id, integer event, sequence param) if message_box("Are you sure you want to quit?","Quit",MB_ICONQUESTION+MB_YESNO) = IDNO then returnValue(-1) end if end procedure setHandler(window,w32HClose,routine_id("onClose_window"))
Windows API:
function WndProc(atom hWnd, atom iMsg, atom wParam, atom lParam) if iMsg = WM_CLOSE and hWnd = window then if message_box("Are you sure you want to quit?","Quit",MB_ICONQUESTION+MB_YESNO) = IDNO then return -1 end if end if return c_func(xDefWndProc,{hWnd,iMsg,wParam,lParam}) end function
Hope this helps you out. EuMario