/[rdesktop]/sourceforge.net/trunk/seamlessrdp/ServerExe/main.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/seamlessrdp/ServerExe/main.c

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

revision 1157 by ossman_, Fri Mar 17 10:48:55 2006 UTC revision 1158 by ossman_, Fri Mar 17 13:11:20 2006 UTC
# Line 33  Line 33 
33    
34  #define APP_NAME "SeamlessRDP Shell"  #define APP_NAME "SeamlessRDP Shell"
35    
 #define FOCUS_MSG_NAME "WM_SEAMLESS_FOCUS"  
 static UINT g_wm_seamless_focus;  
   
36  #ifndef WM_WTSSESSION_CHANGE  #ifndef WM_WTSSESSION_CHANGE
37  #define WM_WTSSESSION_CHANGE 0x02B1  #define WM_WTSSESSION_CHANGE 0x02B1
38  #endif  #endif
# Line 52  typedef void (*remove_hooks_proc_t) (); Line 49  typedef void (*remove_hooks_proc_t) ();
49  typedef int (*get_instance_count_proc_t) ();  typedef int (*get_instance_count_proc_t) ();
50    
51  typedef void (*move_window_proc_t) (HWND hwnd, int x, int y, int width, int height);  typedef void (*move_window_proc_t) (HWND hwnd, int x, int y, int width, int height);
52    typedef void (*zchange_proc_t) (HWND hwnd, HWND behind);
53    typedef void (*focus_proc_t) (HWND hwnd);
54    
55  static move_window_proc_t g_move_window_fn = NULL;  static move_window_proc_t g_move_window_fn = NULL;
56    static zchange_proc_t g_zchange_fn = NULL;
57    static focus_proc_t g_focus_fn = NULL;
58    
59  static void  static void
60  message(const char *text)  message(const char *text)
# Line 167  do_position(HWND hwnd, int x, int y, int Line 168  do_position(HWND hwnd, int x, int y, int
168  static void  static void
169  do_zchange(HWND hwnd, HWND behind)  do_zchange(HWND hwnd, HWND behind)
170  {  {
171          if (behind == NULL)          g_zchange_fn(hwnd, behind);
                 behind = HWND_TOP;  
         SetWindowPos(hwnd, behind, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);  
172  }  }
173    
174  static void  static void
175  do_focus(HWND hwnd)  do_focus(HWND hwnd)
176  {  {
177          SendMessage(hwnd, g_wm_seamless_focus, 0, 0);          g_focus_fn(hwnd);
178  }  }
179    
180  static void  static void
# Line 288  WinMain(HINSTANCE instance, HINSTANCE pr Line 287  WinMain(HINSTANCE instance, HINSTANCE pr
287          remove_hooks_fn = (remove_hooks_proc_t) GetProcAddress(hookdll, "RemoveHooks");          remove_hooks_fn = (remove_hooks_proc_t) GetProcAddress(hookdll, "RemoveHooks");
288          instance_count_fn = (get_instance_count_proc_t) GetProcAddress(hookdll, "GetInstanceCount");          instance_count_fn = (get_instance_count_proc_t) GetProcAddress(hookdll, "GetInstanceCount");
289          g_move_window_fn = (move_window_proc_t) GetProcAddress(hookdll, "SafeMoveWindow");          g_move_window_fn = (move_window_proc_t) GetProcAddress(hookdll, "SafeMoveWindow");
290            g_zchange_fn = (zchange_proc_t) GetProcAddress(hookdll, "SafeZChange");
291            g_focus_fn = (focus_proc_t) GetProcAddress(hookdll, "SafeFocus");
292    
293          if (!set_hooks_fn || !remove_hooks_fn || !instance_count_fn || !g_move_window_fn)          if (!set_hooks_fn || !remove_hooks_fn || !instance_count_fn || !g_move_window_fn
294                || !g_zchange_fn || !g_focus_fn)
295          {          {
296                  FreeLibrary(hookdll);                  FreeLibrary(hookdll);
297                  message("Hook DLL doesn't contain the correct functions. Unable to continue.");                  message("Hook DLL doesn't contain the correct functions. Unable to continue.");
# Line 311  WinMain(HINSTANCE instance, HINSTANCE pr Line 313  WinMain(HINSTANCE instance, HINSTANCE pr
313                  return -1;                  return -1;
314          }          }
315    
         g_wm_seamless_focus = RegisterWindowMessage(FOCUS_MSG_NAME);  
   
316          WTSRegisterSessionNotification(g_hwnd, NOTIFY_FOR_THIS_SESSION);          WTSRegisterSessionNotification(g_hwnd, NOTIFY_FOR_THIS_SESSION);
317    
318          vchannel_open();          vchannel_open();

Legend:
Removed from v.1157  
changed lines
  Added in v.1158

  ViewVC Help
Powered by ViewVC 1.1.26