/[rdesktop]/sourceforge.net/trunk/seamlessrdp/ServerExe/HookDll/hookdll.cpp
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/HookDll/hookdll.cpp

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

revision 1001 by astrand, Tue Aug 30 09:48:07 2005 UTC revision 1002 by astrand, Tue Aug 30 11:17:52 2005 UTC
# Line 92  LRESULT CALLBACK CallWndProc( int nCode, Line 92  LRESULT CALLBACK CallWndProc( int nCode,
92      HWND windowHandle2 = NULL;      HWND windowHandle2 = NULL;
93      char result[ 255 ] = { ""      char result[ 255 ] = { ""
94                           };                           };
     char strWindowId[ 25 ];  
     char type[ 25 ];  
       
     LONG b, t, l, r;  
     char strX[ 5 ];  
     char strY[ 5 ];  
     char strW[ 5 ];  
     char strH[ 5 ];  
       
95      CWPSTRUCT *details = ( CWPSTRUCT * ) lParam;      CWPSTRUCT *details = ( CWPSTRUCT * ) lParam;
96      CREATESTRUCT *cs = ( CREATESTRUCT * ) details->lParam;      CREATESTRUCT *cs = ( CREATESTRUCT * ) details->lParam;
97      LONG dwStyle = GetWindowLong( details->hwnd, GWL_STYLE );      LONG dwStyle = GetWindowLong( details->hwnd, GWL_STYLE );
# Line 118  LRESULT CALLBACK CallWndProc( int nCode, Line 109  LRESULT CALLBACK CallWndProc( int nCode,
109              break;              break;
110                            
111          snprintf( result, sizeof( result ),          snprintf( result, sizeof( result ),
112                    "POSITION1,0x%x,%d,%d,%d,%d,0x%x",                    "POSITION1,0x%p,%d,%d,%d,%d,0x%x",
113                    ( int ) details->hwnd,                    details->hwnd,
114                    rect->left, rect->top,                    rect->left, rect->top,
115                    rect->right - rect->left,                    rect->right - rect->left,
116                    rect->bottom - rect->top,                    rect->bottom - rect->top,
# Line 147  LRESULT CALLBACK CallWndProc( int nCode, Line 138  LRESULT CALLBACK CallWndProc( int nCode,
138                            
139          if ( !( wp->flags & SWP_NOZORDER ) ) {          if ( !( wp->flags & SWP_NOZORDER ) ) {
140              snprintf( result, sizeof( result ),              snprintf( result, sizeof( result ),
141                        "ZCHANGE1,0x%x,0x%x,0x%x\n",                        "ZCHANGE1,0x%p,0x%p,0x%x\n",
142                        details->hwnd,                        details->hwnd,
143                        wp->flags & SWP_NOACTIVATE ? wp->hwndInsertAfter : 0,                        wp->flags & SWP_NOACTIVATE ? wp->hwndInsertAfter : 0,
144                        0 );                        0 );
# Line 160  LRESULT CALLBACK CallWndProc( int nCode, Line 151  LRESULT CALLBACK CallWndProc( int nCode,
151          case WM_CREATE:          case WM_CREATE:
152          if ( cs->style & WS_DLGFRAME ) {          if ( cs->style & WS_DLGFRAME ) {
153              snprintf( result, sizeof( result ),              snprintf( result, sizeof( result ),
154                        "CREATE1,0x%x,0x%x\n",                        "CREATE1,0x%p,0x%x\n",
155                        details->hwnd, 0 );                        details->hwnd, 0 );
156              buffer = result;              buffer = result;
157          }          }
# Line 170  LRESULT CALLBACK CallWndProc( int nCode, Line 161  LRESULT CALLBACK CallWndProc( int nCode,
161          case WM_DESTROY:          case WM_DESTROY:
162          if ( dwStyle & WS_DLGFRAME ) {          if ( dwStyle & WS_DLGFRAME ) {
163              snprintf( result, sizeof( result ),              snprintf( result, sizeof( result ),
164                        "DESTROY1,0x%x,0x%x\n",                        "DESTROY1,0x%p,0x%x\n",
165                        details->hwnd, 0 );                        details->hwnd, 0 );
166              buffer = result;              buffer = result;
167          }          }
# Line 206  LRESULT CALLBACK CbtProc( int nCode, WPA Line 197  LRESULT CALLBACK CbtProc( int nCode, WPA
197      HWND windowHandle = NULL;      HWND windowHandle = NULL;
198      char result[ 255 ] = { ""      char result[ 255 ] = { ""
199                           };                           };
     char strWindowId[ 25 ];  
     char type[ 25 ];  
       
       
     LONG b, t, l, r;  
     char strW[ 5 ];  
     char strY[ 5 ];  
     char strX[ 5 ];  
     char strH[ 5 ];  
     RECT rect;  
       
     int i = 0; //tmp  
       
200      switch ( nCode ) {      switch ( nCode ) {
201          case HCBT_MINMAX:          case HCBT_MINMAX:
202                    
203          windowHandle = ( HWND ) wParam;          if ( ( LOWORD( lParam ) == SW_SHOWMINIMIZED )
204          //get win name                  || ( LOWORD( lParam ) == SW_MINIMIZE ) ) {
205          GetWindowText( windowHandle, windowTitle, 150 );              MessageBox( 0, "Minimizing windows is not allowed in this version. Sorry!", "SeamlessRDP", MB_OK );
206                        return 1;
207          //get an id for it          }
         itoa( ( int ) windowHandle, strWindowId, 10 );  
           
         //get operation type(min,max). if max, do not clip at all,if min use window's previous coords  
         //codes are:  
           
         // SW_HIDE= 0  SW_SHOWNORMAL=1  SW_NORMAL=1  SW_SHOWMINIMIZED=2  SW_SHOWMAXIMIZED=3  SW_MAXIMIZE=3  
         // SW_SHOWNOACTIVATE=4  SW_SHOW=5  SW_MINIMIZE=6  SW_SHOWMINNOACTIVE=7  SW_SHOWNA=8  SW_RESTORE=9  
         // SW_SHOWDEFAULT=10  SW_FORCEMINIMIZE=11  SW_MAX=11  
           
         itoa( ( int ) lParam, type, 10 );  
           
         //get coords  
         GetWindowRect( windowHandle, &rect );  
         b = rect.bottom;  
         t = rect.top;  
         l = rect.left;  
         r = rect.right;  
         ltoa( b - t, strW, 10 );  
         ltoa( t, strY, 10 );  
         ltoa( r - l, strH, 10 );  
         ltoa( l, strX, 10 );  
           
         //get name  
         GetWindowText( windowHandle, windowTitle, 150 );  
           
         ////setup return string  
         strcat( result, "MSG=HCBT_MINMAX;OP=4;" );  
           
         // SW_SHOWNOACTIVATE=4  SW_SHOW=5  SW_MINIMIZE=6  SW_SHOWMINNOACTIVE=7  SW_SHOWNA=8  SW_RESTORE=9  
         // SW_SHOWDEFAULT=10  SW_FORCEMINIMIZE=11  SW_MAX=11  
         strcat( result, "ID=" );  
         strcat( result, strWindowId );  
         strcat( result, ";" );  
         strcat( result, "TITLE=" );  
         strcat( result, windowTitle );  
         strcat( result, ";" );  
         strcat( result, "X=" );  
         strcat( result, strX );  
         strcat( result, ";" );  
         strcat( result, "Y=" );  
         strcat( result, strY );  
         strcat( result, ";" );  
         strcat( result, "H=" );  
         strcat( result, strH );  
         strcat( result, ";" );  
         strcat( result, "W=" );  
         strcat( result, strW );  
         strcat( result, ";" );  
         strcat( result, "TYPE=" );  
         strcat( result, type );  
         strcat( result, "." );  
           
         //-------------------------------------------------------------------------------------------------  
         // code to prevent minimising windows (can be removed once minimise has been implemented)  
         //i = (int)lParam;  
         //if (i==0 || i==2 || i==6 || i==7 || i==8 || i==11)  
         //if ( i==2 || i==6 )  
         //{  
         // MessageBox(0,"Minimising windows is not allowed in this version. Sorry!","TS Window Clipper", MB_OK);  
         // return 1;  
         //}  
         //-----------------------------------------------------------------------------------------  
           
         //-------------------------------------------------------------------------------------------------  
         // code to prevent maximising windows (can be removed once maximise has been implemented)  
         //i = (int)lParam;  
         //if (i==3 || i==9 || i==11)  
         //if (i==3 || i==11)  
         //{  
         // MessageBox(0,"Maximising windows is not allowed in this version. Sorry!","TS Window Clipper", MB_OK);  
         // return 1;  
         //}  
         //-----------------------------------------------------------------------------------------  
208                    
209          buffer = result;          GetWindowText( ( HWND ) wParam, windowTitle, 150 );
210                    
211            snprintf( result, sizeof( result ),
212                      "SETSTATE1,0x%p,%s,0x%x,0x%x\n",
213                      ( HWND ) wParam,
214                      windowTitle,
215                      LOWORD( lParam ),
216                      0 );
217            buffer = result;
218          break;          break;
219                    
220            
221          default:          default:
222          break;          break;
223      }      }

Legend:
Removed from v.1001  
changed lines
  Added in v.1002

  ViewVC Help
Powered by ViewVC 1.1.26