/[winpt]/trunk/PTD/PTD.cpp
ViewVC logotype

Diff of /trunk/PTD/PTD.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 32 by twoaday, Mon Oct 24 08:03:48 2005 UTC revision 33 by twoaday, Tue Oct 25 07:46:20 2005 UTC
# Line 29  HINSTANCE glob_hinst; Line 29  HINSTANCE glob_hinst;
29    
30  /* We need a special section in the DLL for storing our shared data */  /* We need a special section in the DLL for storing our shared data */
31  #pragma data_seg(".SHARDAT")  #pragma data_seg(".SHARDAT")
32  static HHOOK cbt_hook = NULL;  static HHOOK    cbt_hook = NULL;    /* CTB hook handle. */
33  static DWORD tray_proc_id = 0;  static DWORD    tray_proc_id = 0;   /* WinPT PID */
34  static HWND shell_traywnd = 0;  static HWND     shell_traywnd = 0;  /* Tray window handle. */
35  static HWND curr_focus = NULL;  static HWND     curr_focus = NULL;  /* Current window focus handle. */
36  static HWND rebar_w32 = NULL;  static HWND     rebar_w32 = NULL;
37  static HWND mstask_swc = NULL;  static HWND     mstask_swc = NULL;
38  static HWND systab_c32 = NULL;  static HWND     systab_c32 = NULL;
39  #pragma data_seg()  #pragma data_seg()
40    
41  static unsigned * journ_keys = 0;  static unsigned *journ_keys = 0;
42  static unsigned key_idx = 0;  static unsigned key_idx = 0;
43  static unsigned nkeys = 0;  static unsigned nkeys = 0;
44  static HHOOK journ_hook = NULL;  static HHOOK journ_hook = NULL;     /* Journaling hook  handle. */
45    
46    
47  static LRESULT CALLBACK  static LRESULT CALLBACK
# Line 91  PTD_initialize (void) Line 91  PTD_initialize (void)
91          return FALSE;          return FALSE;
92            
93      /* Okay, what are we doing here:      /* Okay, what are we doing here:
94       * In the past I used the Spy++ application to find out why the old current window       * In the past I used the Spy++ application to find out why the old current
95       * doesn't work on so much systems. Now we try to use the computer based training       * window doesn't work on so much systems. Now we try to use the computer
96       * hook, more precise the HCBT_SETFOCUS to find out the last window focus. But to       * based training hook, more precise the HCBT_SETFOCUS to find out the
97       * succeed we need to ignore some windows because otherwise our own window or a       * last window focus. But to succeed we need to ignore some windows
98       * window from the taskbar would be recognized.       * because otherwise our own window or a window from the taskbar
99         * would be recognized.
100       *       *
101       * Here is what the Spy++ says about the windows order:       * Here is what the Spy++ says about the windows order:
102       * Shell_TrayWnd       * Shell_TrayWnd
# Line 103  PTD_initialize (void) Line 104  PTD_initialize (void)
104       *                \ MSTaskSwWClass       *                \ MSTaskSwWClass
105       *                               \ SysTabControl32       *                               \ SysTabControl32
106       *       *
107       * As a result we need to ignore those windows to prevent failured in the code.       * As a result we need to ignore those windows to prevent failured
108         * in the code.
109       */       */
110      shell_traywnd = FindWindowEx (NULL, NULL, "Shell_TrayWnd", NULL);      shell_traywnd = FindWindowEx (NULL, NULL, "Shell_TrayWnd", NULL);
111      rebar_w32 = FindWindowEx (shell_traywnd, NULL, "ReBarWindow32", NULL);      rebar_w32 = FindWindowEx (shell_traywnd, NULL, "ReBarWindow32", NULL);
112      mstask_swc = FindWindowEx (rebar_w32, NULL, "MSTaskSwWClass", NULL);      mstask_swc = FindWindowEx (rebar_w32, NULL, "MSTaskSwWClass", NULL);
113      systab_c32 = FindWindowEx (mstask_swc, NULL, "SysTabControl32", NULL);      systab_c32 = FindWindowEx (mstask_swc, NULL, "SysTabControl32", NULL);
114            
115      /*_log_box ("tray_proc_id=%u cbt_hook=%p shell_traywnd=%p rebar_w32=%p "      /*log_foo ("tray_proc_id=%u cbt_hook=%p shell_traywnd=%p rebar_w32=%p "
116                  "mstask_swc=%p systab_c32=%p",                 "mstask_swc=%p systab_c32=%p",
117                  tray_proc_id, cbt_hook, shell_traywnd, rebar_w32,                 tray_proc_id, cbt_hook, shell_traywnd, rebar_w32,
118                  mstask_swc, systab_c32);*/                 mstask_swc, systab_c32);*/
119            
120      return TRUE;      return TRUE;
121  }  }
# Line 221  PTD_keyb_send (UINT *keys, UINT n_keys) Line 223  PTD_keyb_send (UINT *keys, UINT n_keys)
223  }  }
224    
225    
226    /* Return version of the PTD library. */
227  const char *  const char *
228  PTD_get_version (void)  PTD_get_version (void)
229  {  {
# Line 237  PTD_jpg_show (HWND hwnd, POINT *p, LPCST Line 240  PTD_jpg_show (HWND hwnd, POINT *p, LPCST
240      POINT p2;      POINT p2;
241      BOOL rc;      BOOL rc;
242    
243      rc = jpg.Load (name);      rc = jpg.load (name);
244      if (!rc)      if (!rc)
245          return -1;          return -1; /* XXX: use real return code. */
246      hdc = GetWindowDC (hwnd);      hdc = GetWindowDC (hwnd);
247      rc = jpg.UpdateSizeOnDC (hdc);      rc = jpg.updateSizeOnDC (hdc);
248      if (!rc) {      if (!rc) {
249          ReleaseDC (hwnd, hdc);          ReleaseDC (hwnd, hdc);
250          return -2;          return -2; /* XXX: use real return code. */
251      }      }
252    
253      p2.x = jpg.m_Width;      p2.x = jpg.m_Width;
254      p2.y = jpg.m_Height;      p2.y = jpg.m_Height;
255      rc = jpg.Show (hdc, p, &p2, 0, 0);      rc = jpg.show (hdc, p, &p2, 0, 0);
256    
257      ReleaseDC (hwnd, hdc);      ReleaseDC (hwnd, hdc);
258      jpg.FreePictureData ();      jpg.freePictureData ();
259      return rc;      return rc;
260  }  }
261    

Legend:
Removed from v.32  
changed lines
  Added in v.33

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26