/[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 31 by twoaday, Mon Jan 31 11:02:21 2005 UTC revision 32 by twoaday, Mon Oct 24 08:03:48 2005 UTC
# Line 20  Line 20 
20    
21  #include <windows.h>  #include <windows.h>
22  #include <stdio.h>  #include <stdio.h>
23    #include <ocidl.h>
24    #include <olectl.h>
25    
26    #include "wptJPG.h"
27    
28  HINSTANCE glob_hinst;  HINSTANCE glob_hinst;
29    
# Line 66  PTD_CBT_proc (int code, WPARAM wparam, L Line 70  PTD_CBT_proc (int code, WPARAM wparam, L
70      }      }
71            
72      return  CallNextHookEx (cbt_hook , code, wparam, lparam);      return  CallNextHookEx (cbt_hook , code, wparam, lparam);
73  } /* PTD_CBT_proc */  }
74    
75    
76    /* Return the last selected window */
77  HWND  HWND
78  PTD_get_curr_hwnd (void)  PTD_get_curr_hwnd (void)
79  {  {
80      return curr_focus;      return curr_focus;
81  } /* PTD_get_curr_hwnd */  }
82    
83    
84    /* Initialize CTB hook and try to find the system windows. */
85  BOOL  BOOL
86  PTD_initialize (void)  PTD_initialize (void)
87  {  {
88      tray_proc_id = GetCurrentProcessId( );      tray_proc_id = GetCurrentProcessId ();
89      cbt_hook = SetWindowsHookEx( WH_CBT, PTD_CBT_proc, glob_hinst, 0 );      cbt_hook = SetWindowsHookEx (WH_CBT, PTD_CBT_proc, glob_hinst, 0);
90      if( cbt_hook == NULL )                    if (cbt_hook == NULL)
91          return FALSE;          return FALSE;
92            
93      /* Okay, what are we doing here:      /* Okay, what are we doing here:
# Line 110  PTD_initialize (void) Line 116  PTD_initialize (void)
116                  mstask_swc, systab_c32);*/                  mstask_swc, systab_c32);*/
117            
118      return TRUE;      return TRUE;
119  } /* PTD_initialize */  }
120    
121    
122    /* Remove the CTB hook from the system and reset all variables. */
123  void  void
124  PTD_delete (void)  PTD_delete (void)
125  {  {
# Line 122  PTD_delete (void) Line 129  PTD_delete (void)
129      cbt_hook = NULL;      cbt_hook = NULL;
130      shell_traywnd = NULL;      shell_traywnd = NULL;
131      tray_proc_id = 0;      tray_proc_id = 0;
132  } /* PTD_delete */  }
133    
134    
135    /* Return if the CTB hook is currently used. */
136  int  int
137  PTD_is_used (void)  PTD_is_used (void)
138  {  {
139      return shell_traywnd && cbt_hook;      return shell_traywnd && cbt_hook;
140  } /* PTD_is_used */  }
141    
142    
143  LRESULT CALLBACK  static LRESULT CALLBACK
144  PTD_playback_proc (int code, WPARAM wparam, LPARAM lparam)  PTD_playback_proc (int code, WPARAM wparam, LPARAM lparam)
145  {  {
146      LPEVENTMSG em;      LPEVENTMSG em;
# Line 167  PTD_playback_proc (int code, WPARAM wpar Line 175  PTD_playback_proc (int code, WPARAM wpar
175  } /* PTD_Playback_proc */  } /* PTD_Playback_proc */
176    
177    
178    
179  BOOL  BOOL
180  PTD_keyb_send (UINT * keys, UINT n_keys)  PTD_keyb_send (UINT *keys, UINT n_keys)
181  {  {
182      MSG msg;      MSG msg;
   
183      journ_keys = keys;      journ_keys = keys;
184      key_idx = 0;      key_idx = 0;
185      nkeys =  n_keys;          nkeys =  n_keys;    
# Line 210  PTD_keyb_send (UINT * keys, UINT n_keys) Line 218  PTD_keyb_send (UINT * keys, UINT n_keys)
218      }      }
219            
220      return TRUE;      return TRUE;
221  } /* PTD_keyb_send */  }
222    
223    
224  const char *  const char *
225  PTD_get_version (void)  PTD_get_version (void)
226  {  {
227      return "0.8.0";      return "0.8.1";
228  } /* PTD_get_version */  }
229    
230    
231    /* Display a JPG picture in the given window at the given point. */
232    int
233    PTD_jpg_show (HWND hwnd, POINT *p, LPCSTR name)
234    {
235        CJPG jpg;
236        HDC hdc;
237        POINT p2;
238        BOOL rc;
239    
240        rc = jpg.Load (name);
241        if (!rc)
242            return -1;
243        hdc = GetWindowDC (hwnd);
244        rc = jpg.UpdateSizeOnDC (hdc);
245        if (!rc) {
246            ReleaseDC (hwnd, hdc);
247            return -2;
248        }
249    
250        p2.x = jpg.m_Width;
251        p2.y = jpg.m_Height;
252        rc = jpg.Show (hdc, p, &p2, 0, 0);
253    
254        ReleaseDC (hwnd, hdc);
255        jpg.FreePictureData ();
256        return rc;
257    }
258    
259    
260                                    
261  BOOL WINAPI  BOOL WINAPI
# Line 235  DllMain (HINSTANCE hinst, DWORD reason, Line 273  DllMain (HINSTANCE hinst, DWORD reason,
273          break;          break;
274      }      }
275      return TRUE;      return TRUE;
276  } /* DllMain */  }
277    

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26