[Winpt-commits] r412 - trunk/PTD

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Sat Feb 11 16:03:43 CET 2012


Author: twoaday
Date: 2012-02-11 16:03:43 +0100 (Sat, 11 Feb 2012)
New Revision: 412

Modified:
   trunk/PTD/ChangeLog
   trunk/PTD/PTD.cpp
Log:
2012-02-11  Timo Schulz  <twoaday at gmx.net>

        * PTD.cpp (PTD_CBT_proc): Additional comments and
	style cleanups.
		


Modified: trunk/PTD/ChangeLog
===================================================================
--- trunk/PTD/ChangeLog	2012-02-08 18:49:41 UTC (rev 411)
+++ trunk/PTD/ChangeLog	2012-02-11 15:03:43 UTC (rev 412)
@@ -1,3 +1,8 @@
+2012-02-11  Timo Schulz  <twoaday at gmx.net>
+
+        * PTD.cpp (PTD_CBT_proc): Additional comments and
+	style cleanups.
+	
 2011-12-13  Timo Schulz  <twoaday at gmx.net>
 
 	* Makefile.am: Enabled SSP again.

Modified: trunk/PTD/PTD.cpp
===================================================================
--- trunk/PTD/PTD.cpp	2012-02-08 18:49:41 UTC (rev 411)
+++ trunk/PTD/PTD.cpp	2012-02-11 15:03:43 UTC (rev 412)
@@ -1,5 +1,5 @@
 /* PTD.cpp - Privacy Tray Dynamic
- *	Copyright (C) 2002-2009 Timo Schulz
+ *	Copyright (C) 2002-2009, 2012 Timo Schulz
  *
  * This file is part of WinPT.
  *
@@ -20,6 +20,7 @@
 #include <windows.h>
 #include <stdio.h>
 
+/* Reference to the DLL module handle */
 HINSTANCE glob_hinst;
 
 /* We need a special section in the DLL for storing our shared data.
@@ -45,34 +46,36 @@
 #endif
 #undef ATTR_SEC
 
+/* Static variables that are used to record and replay key strokes */
 static unsigned *journ_keys = 0;
 static unsigned keyidx = 0;
 static unsigned nkeys = 0;
 static HHOOK journ_hook = NULL;	 /* Journaling hook  handle. */
 
 
-
+/* Callback function for the Computer Based Training (CBT) hook */
 static LRESULT CALLBACK
 PTD_CBT_proc (int code, WPARAM wparam, LPARAM lparam)
 {
-    HWND curr_hwnd = NULL;	
-    DWORD proc_id = 0;
+    HWND curr_hwnd;
+    DWORD proc_id;
     
     if (code >= 0 && code == HCBT_SETFOCUS) {
         /* A window is about to receive the keyboard focus */		
         
+	proc_id = 0;
         curr_hwnd = (HWND)wparam;
         GetWindowThreadProcessId (curr_hwnd, &proc_id);
         /* Only if the current window is different from this window list,
            we set the new focus. For more information read the hint in 
 	   PTD_initialize. */
-        if ((proc_id != tray_proc_id)
-             && (curr_hwnd != NULL)
-             && (curr_hwnd != curr_focus)
-             && (curr_hwnd != shell_traywnd)
-             && (curr_hwnd != systab_c32)
-             && (curr_hwnd != mstask_swc)
-             && (curr_hwnd != rebar_w32)) {
+        if ((proc_id != tray_proc_id) &&
+	    (curr_hwnd != NULL) &&
+	    (curr_hwnd != curr_focus) &&
+	    (curr_hwnd != shell_traywnd) &&
+	    (curr_hwnd != systab_c32) &&
+	    (curr_hwnd != mstask_swc) &&
+	    (curr_hwnd != rebar_w32)) {
             curr_focus = curr_hwnd;
         }
     }
@@ -101,7 +104,7 @@
     /* Okay, what are we doing here:
      * In the past I used the Spy++ application to find out why the old current 
      * window doesn't work on so much systems. Now we try to use the computer 
-     * based training hook, more precise the HCBT_SETFOCUS to find out the 
+     * based training hook, more precisely the HCBT_SETFOCUS to find out the 
      * last window focus. But to succeed we need to ignore some windows 
      * because otherwise our own window or a window from the taskbar
      * would be recognized.
@@ -245,7 +248,6 @@
 {
     switch (reason)  {
     case DLL_PROCESS_ATTACH:
-	/* Handle to the attached process */
 	glob_hinst = hinst;
 	break;
        



More information about the Winpt-commits mailing list