/[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 60 by twoaday, Wed Nov 2 13:50:48 2005 UTC revision 61 by werner, Wed Nov 2 14:48:01 2005 UTC
# Line 32  Line 32 
32    
33  HINSTANCE glob_hinst;  HINSTANCE glob_hinst;
34    
35  /* 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.
36       This shared data is required by the hook function becuase theat
37       function is called in the context of the actual thread running the
38       hook and thus we need a way to communicate the result of our hook
39       function back to us.  We use a shared data segment for this. */
40    #ifdef __GNUC__
41    #define ATTR_SEC __attribute__((section (".SHARDAT"), shared))
42    #else
43    #define ATTR_SEC
44  #pragma data_seg(".SHARDAT")  #pragma data_seg(".SHARDAT")
45  static HHOOK    cbt_hook = NULL;    /* CTB hook handle. */  #endif
46  static DWORD    tray_proc_id = 0;   /* WinPT PID */  static HHOOK cbt_hook      ATTR_SEC = NULL; /* CTB hook handle. */
47  static HWND     shell_traywnd = 0;  /* Tray window handle. */  static DWORD tray_proc_id  ATTR_SEC = 0;    /* WinPT PID */
48  static HWND     curr_focus = NULL;  /* Current window focus handle. */  static HWND  shell_traywnd ATTR_SEC = 0;    /* Tray window handle. */
49  static HWND     rebar_w32 = NULL;  static HWND  curr_focus    ATTR_SEC = NULL; /* Current window focus handle. */
50  static HWND     mstask_swc = NULL;  static HWND  rebar_w32     ATTR_SEC = NULL;
51  static HWND     systab_c32 = NULL;  static HWND  mstask_swc    ATTR_SEC = NULL;
52    static HWND  systab_c32    ATTR_SEC = NULL;
53    #ifndef __GNUC__
54  #pragma data_seg()  #pragma data_seg()
55    #endif
56    #undef ATTR_SEC
57    
58    
59  static unsigned *journ_keys = 0;  static unsigned *journ_keys = 0;
60  static unsigned key_idx = 0;  static unsigned key_idx = 0;
# Line 93  PTD_initialize (void) Line 106  PTD_initialize (void)
106      tray_proc_id = GetCurrentProcessId ();      tray_proc_id = GetCurrentProcessId ();
107      cbt_hook = SetWindowsHookEx (WH_CBT, PTD_CBT_proc, glob_hinst, 0);      cbt_hook = SetWindowsHookEx (WH_CBT, PTD_CBT_proc, glob_hinst, 0);
108      if (cbt_hook == NULL)      if (cbt_hook == NULL)
       {  
         char buf[500];  
                   
         FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError (),  
                    MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),  
                    buf, sizeof buf -1, NULL);  
         MessageBox (NULL, buf, "Error", MB_OK|MB_ICONSTOP);  
109          return FALSE;          return FALSE;
       }  
110            
111    
112      /* Okay, what are we doing here:      /* Okay, what are we doing here:
# Line 267  PTD_jpg_show (HWND hwnd, POINT *p, LPCST Line 272  PTD_jpg_show (HWND hwnd, POINT *p, LPCST
272    
273    
274                                    
275  BOOL WINAPI  extern "C" int WINAPI
276  DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserv)  DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserv)
277  {  {
278      switch (reason)  {      switch (reason)  {

Legend:
Removed from v.60  
changed lines
  Added in v.61

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26