<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18812"></HEAD>
<BODY style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 15px" 
id=MailContainerBody leftMargin=0 topMargin=0 CanvasTabStop="true" 
name="Compose message area">
<DIV><FONT size=2 face=Arial>tk/tcl is not abele to catch WM_QUERYENDSESSION 
and&nbsp;WM_ENDSESSION tk needs to be patched ive found this patch searching 
around on Google</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><PRE>"Patch:
*** tkWinX.c        Sat Oct 10 02:30:37 1998
--- tkWinX.c_new        Fri Mar 12 11:25:00 1999
***************
*** 50,55 ****
--- 50,63 ----
                              LPARAM lParam));
  static void                 GetTranslatedKey _ANSI_ARGS_((XKeyEvent
*xkey));
  


+ static void (*fd_tcl_exit_callback_function_ptr)() = NULL;

+ void fd_tcl_register_exit_callback(void (*func_ptr)())   
+ {   
+    fd_tcl_exit_callback_function_ptr = func_ptr;
+ }

  /*
  
*----------------------------------------------------------------------
   *
***************
*** 588,593 ****
--- 596,615 ----
              Tk_PointerEvent(hwnd, (short) LOWORD(lParam),
                      (short) HIWORD(lParam));
              return 1;

+    case WM_QUERYENDSESSION: {       
+        *resultPtr = 1;
+        return 1;
+    }

+    case WM_ENDSESSION: {
+        if ( wParam == TRUE ) {
+            if ( fd_tcl_exit_callback_function_ptr != NULL ) {
+                (*fd_tcl_exit_callback_function_ptr)();
+            }
+        } 
+        return 1;
+    }
  
          case WM_CLOSE:
          case WM_SETFOCUS:


PatchFiles:
    win/tkWinX.c
    
    And, you have to modify 'winmain.c'
    
       extern void fd_tcl_register_exit_callback(void (*func_ptr)());
    
       static Tcl_Interp *YOUR_TCL_INTERPRETER;
    
       void fd_logoff_callback()
       {
          char * command = "YOUR_TCL_EXIT_PROC";
          Tcl_Obj * cmdObj = Tcl_NewStringObj(command, -1);
          if ( Tcl_GlobalEvalObj(YOUR_TCL_INTERPRETER, cmdObj) ==
TCL_ERROR
    ) {
             exit(1);
          }
       }
    
       ...
       /* Just before calling TkMain() */
       fd_tcl_register_exit_callback(fd_logoff_callback);
       ...
    
    YOUR_TCL_EXIT_PROC is the Tcl procedure that will get called when
a
    logout, restart or shutdown occurs.
    
    

Comments:
    To handle the WM_QUERYENDSESSION and WM_ENDSESSION events on
Windows, we
    added an 'fd_tcl_register_exit_callback()' function to Tk to 
    register a C callback function.  
    
    When receiving a WM_ENDSESSION event with LogOff == TRUE (which
will
    only
    happen when all running applications returned TRUE when receiving
the 
    WM_QUERYENDSESSION event) the registered function will be called.
    
    This patch currently fits our needs, but it should be generalized.
    We added a 'hook' to call the registered callback function, but a
better
    solution would be to provide a new Tcl builtin on Windows to
register a
    Tcl logout procedure."

so is there anyone knowing c that can build this for phyton??
thanks for help </PRE><PRE>&nbsp;</PRE><PRE>/Alex</PRE></DIV></BODY></HTML>