CVS: seamlessrdp/ServerExe/HookDll hookdll.cpp,1.14,1.15

Peter Åstrand <[email protected]>
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/seamlessrdp/ServerExe/HookDll
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13488

Modified Files:
	hookdll.cpp 
Log Message:
Fixed compiler warnings: Removed unused variables. Using %p for
converting HWND to hex. 

Implemented SETSTATE1.


Index: hookdll.cpp
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/HookDll/hookdll.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** hookdll.cpp	30 Aug 2005 09:48:07 -0000	1.14
--- hookdll.cpp	30 Aug 2005 11:17:52 -0000	1.15
***************
*** 93,105 ****
      char result[ 255 ] = { ""
                           };
-     char strWindowId[ 25 ];
-     char type[ 25 ];
-     
-     LONG b, t, l, r;
-     char strX[ 5 ];
-     char strY[ 5 ];
-     char strW[ 5 ];
-     char strH[ 5 ];
-     
      CWPSTRUCT *details = ( CWPSTRUCT * ) lParam;
      CREATESTRUCT *cs = ( CREATESTRUCT * ) details->lParam;
--- 93,96 ----
***************
*** 119,124 ****
              
          snprintf( result, sizeof( result ),
!                   "POSITION1,0x%x,%d,%d,%d,%d,0x%x",
!                   ( int ) details->hwnd,
                    rect->left, rect->top,
                    rect->right - rect->left,
--- 110,115 ----
              
          snprintf( result, sizeof( result ),
!                   "POSITION1,0x%p,%d,%d,%d,%d,0x%x",
!                   details->hwnd,
                    rect->left, rect->top,
                    rect->right - rect->left,
***************
*** 148,152 ****
          if ( !( wp->flags & SWP_NOZORDER ) ) {
              snprintf( result, sizeof( result ),
!                       "ZCHANGE1,0x%x,0x%x,0x%x\n",
                        details->hwnd,
                        wp->flags & SWP_NOACTIVATE ? wp->hwndInsertAfter : 0,
--- 139,143 ----
          if ( !( wp->flags & SWP_NOZORDER ) ) {
              snprintf( result, sizeof( result ),
!                       "ZCHANGE1,0x%p,0x%p,0x%x\n",
                        details->hwnd,
                        wp->flags & SWP_NOACTIVATE ? wp->hwndInsertAfter : 0,
***************
*** 161,165 ****
          if ( cs->style & WS_DLGFRAME ) {
              snprintf( result, sizeof( result ),
!                       "CREATE1,0x%x,0x%x\n",
                        details->hwnd, 0 );
              buffer = result;
--- 152,156 ----
          if ( cs->style & WS_DLGFRAME ) {
              snprintf( result, sizeof( result ),
!                       "CREATE1,0x%p,0x%x\n",
                        details->hwnd, 0 );
              buffer = result;
***************
*** 171,175 ****
          if ( dwStyle & WS_DLGFRAME ) {
              snprintf( result, sizeof( result ),
!                       "DESTROY1,0x%x,0x%x\n",
                        details->hwnd, 0 );
              buffer = result;
--- 162,166 ----
          if ( dwStyle & WS_DLGFRAME ) {
              snprintf( result, sizeof( result ),
!                       "DESTROY1,0x%p,0x%x\n",
                        details->hwnd, 0 );
              buffer = result;
***************
*** 207,309 ****
      char result[ 255 ] = { ""
                           };
-     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
-     
      switch ( nCode ) {
          case HCBT_MINMAX:
          
!         windowHandle = ( HWND ) wParam;
!         //get win name
!         GetWindowText( windowHandle, windowTitle, 150 );
!         
!         //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;
!         //}
!         //-----------------------------------------------------------------------------------------
          
          buffer = result;
-         
          break;
          
          default:
          break;
--- 198,222 ----
      char result[ 255 ] = { ""
                           };
      switch ( nCode ) {
          case HCBT_MINMAX:
          
!         if ( ( LOWORD( lParam ) == SW_SHOWMINIMIZED )
!                 || ( LOWORD( lParam ) == SW_MINIMIZE ) ) {
!             MessageBox( 0, "Minimizing windows is not allowed in this version. Sorry!", "SeamlessRDP", MB_OK );
!             return 1;
!         }
          
!         GetWindowText( ( HWND ) wParam, windowTitle, 150 );
          
+         snprintf( result, sizeof( result ),
+                   "SETSTATE1,0x%p,%s,0x%x,0x%x\n",
+                   ( HWND ) wParam,
+                   windowTitle,
+                   LOWORD( lParam ),
+                   0 );
          buffer = result;
          break;
          
+         
          default:
          break;



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.