/[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 324 by twoaday, Fri Mar 23 11:32:28 2007 UTC revision 325 by twoaday, Fri Sep 25 15:51:28 2009 UTC
# Line 1  Line 1 
1  /* PTD.cpp - Privacy Tray Dynamic  /* PTD.cpp - Privacy Tray Dynamic
2   *      Copyright (C) 2002-2007 Timo Schulz   *      Copyright (C) 2002-2009 Timo Schulz
3   *   *
4   * This file is part of WinPT.   * This file is part of WinPT.
5   *   *
# Line 19  Line 19 
19    
20  #include <windows.h>  #include <windows.h>
21  #include <stdio.h>  #include <stdio.h>
 #include <ocidl.h>  
 #include <olectl.h>  
   
 #include "wptJPG.h"  
22    
23  HINSTANCE glob_hinst;  HINSTANCE glob_hinst;
24    
# Line 55  static unsigned nkeys = 0; Line 51  static unsigned nkeys = 0;
51  static HHOOK journ_hook = NULL;  /* Journaling hook  handle. */  static HHOOK journ_hook = NULL;  /* Journaling hook  handle. */
52    
53    
 void dns_cleanup (void);  
   
54    
55  static LRESULT CALLBACK  static LRESULT CALLBACK
56  PTD_CBT_proc (int code, WPARAM wparam, LPARAM lparam)  PTD_CBT_proc (int code, WPARAM wparam, LPARAM lparam)
# Line 141  PTD_delete (void) Line 135  PTD_delete (void)
135  {  {
136      if (!cbt_hook)      if (!cbt_hook)
137          return;          return;
     dns_cleanup ();  
138      UnhookWindowsHookEx (cbt_hook);      UnhookWindowsHookEx (cbt_hook);
139      cbt_hook = NULL;      cbt_hook = NULL;
140      shell_traywnd = NULL;      shell_traywnd = NULL;
# Line 199  PTD_keyb_send (UINT *keys, UINT n_keys) Line 192  PTD_keyb_send (UINT *keys, UINT n_keys)
192      MSG msg;      MSG msg;
193      journ_keys = keys;      journ_keys = keys;
194      keyidx = 0;      keyidx = 0;
195      nkeys =  n_keys;          nkeys = n_keys;    
196            
197      if (journ_hook)      if (journ_hook)
198          return FALSE;          return FALSE;
# Line 238  PTD_keyb_send (UINT *keys, UINT n_keys) Line 231  PTD_keyb_send (UINT *keys, UINT n_keys)
231  }  }
232    
233    
234  /* Display a JPG picture in the given window at the given point. */  /*FILE *fp;*/
 extern "C" int  
 PTD_jpg_show (HWND hwnd, POINT *p, LPCSTR name)  
 {  
     CJPG jpg;  
     HDC hdc;  
     POINT sizewnd;  
     RECT rwnd;  
     BOOL rc;  
   
     rc = jpg.load (name);  
     if (!rc)  
         return -1; /* XXX: use real return code. */  
     hdc = GetWindowDC (hwnd);  
     rc = jpg.updateSizeOnDC (hdc);  
     if (!rc) {  
         ReleaseDC (hwnd, hdc);  
         return -2; /* XXX: use real return code. */  
     }  
235    
     GetWindowRect (hwnd, &rwnd);  
     sizewnd.x = rwnd.right - rwnd.left;  
     sizewnd.y = rwnd.bottom - rwnd.top;  
     rc = jpg.show (hdc, p, &sizewnd, 0, 0);  
   
     ReleaseDC (hwnd, hdc);  
     jpg.freePictureData ();  
     return rc;  
 }  
   
                   
236  extern "C" BOOL WINAPI  extern "C" BOOL WINAPI
237  DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserv)  DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserv)
238  {  {
239      switch (reason)  {      switch (reason)  {
240      case DLL_PROCESS_ATTACH:      case DLL_PROCESS_ATTACH:
241          glob_hinst = hinst;          glob_hinst = hinst;
242            /*
243            fp = fopen ("attach_pid.txt", "a+b");
244            if (fp != NULL) {      
245                fprintf (fp, "[+ %lu]\r\n", GetCurrentProcessId());
246                fclose (fp);
247            }*/      
248          break;          break;
249      case DLL_THREAD_ATTACH:          
250        case DLL_PROCESS_DETACH:
251            /*fp = fopen ("attach_pid.txt", "a+b");
252            if (fp != NULL) {
253                fprintf (fp, "[- %lu]\r\n", GetCurrentProcessId());
254                fclose (fp);
255            }*/
256          break;          break;
257            
258        case DLL_THREAD_ATTACH:  
259      case DLL_THREAD_DETACH:        case DLL_THREAD_DETACH:  
260          break;          break;
261      case DLL_PROCESS_DETACH:          
         break;  
262      }      }
263        
264      return TRUE;      return TRUE;
265  }  }

Legend:
Removed from v.324  
changed lines
  Added in v.325

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26