I´we been crazy looking on google after this the protocol function won´t work

I need to make something happen at those events
WM_QUERYENDSESSION WM_ENDSESSION WM_QUIT WM_DESTROY WM_CLOSE


Thanks for help


yours truly
Alexander

Recommended Answers

All 3 Replies

Are you sure you posted in the right place? This is not the Mindreader Forum!

Are you sure you posted in the right place? This is not the Mindreader Forum!

need more info / source code what do you want to know
sometimes you have to read between the lines
.if you don't try to help fine then il just go on try to find something at google.

OK here this is the basic idea when whindols/os shut-down python will save some data into a csv file.
what more can I give :)

you diden´t have to read my mind to get that

import win32con
import win32api
import win32gui

OK got to make a tk patch whit this code
and I don't want to go and get C++

*** 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.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.