From b0f2aecd524a308d302adec61dac1ca1e42cdd50 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 29 May 2009 16:09:51 +0000 Subject: [PATCH] 2009-05-29 18:04 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/gtwvg/gtwvg.h + Added extern for hb_wvt_GetStringAttrib(), hb_wvt_PutStringAttrib(). Required by terminal example. * contrib/gtwvg/wvggui.h * Comment format. Synced with gtwvg.h. - examples/terminal/trm_server.prg + examples/terminal/trm_srv.prg - examples/terminal/trm_client.prg + examples/terminal/trm_cli.prg - examples/terminal/trm_appn.prg + examples/terminal/trm_app.prg - examples/terminal/trm_appn.hbm + examples/terminal/trm_app.hbp + examples/terminal/trm_misc.c + examples/terminal/trm_cli.hbp + examples/terminal/trm_srv.hbp * examples/terminal/terminal.prg * examples/terminal/terminal.hbc * examples/terminal/readme.txt ! Removed all inline stuff. ! Fixed problems with mixing C++/C objects due to inline and missing function declarations. % Windows only function replaced with RTL one. * Renamed *.hbm files to .hbp, so now it's easy to build the whole project with: hbmk2 trm_app.hbp trm_cli.hbp trm_srv.hbp ! Fixed hard coded local executable names + dirs. ! Synced client and server default ports. ; Now all of these tools build ok and they also work. * contrib/hbwin/legacyc.c ! Deleted recently added compat calls. (they are static in xhb and they collide with RTL names) * examples/hbgf/hbgfgtk/hbgfgtk.hbm ! Minor fix. --- harbour/ChangeLog | 39 +++++ harbour/contrib/gtwvg/gtwvg.h | 2 + harbour/contrib/gtwvg/wvggui.h | 2 +- harbour/contrib/hbwin/legacyc.c | 30 ---- harbour/examples/hbgf/hbgfgtk/hbgfgtk.hbm | 2 +- harbour/examples/terminal/readme.txt | 7 +- harbour/examples/terminal/terminal.hbc | 3 +- harbour/examples/terminal/terminal.prg | 41 +---- harbour/examples/terminal/trm_app.hbp | 7 + .../terminal/{trm_appn.prg => trm_app.prg} | 0 harbour/examples/terminal/trm_appn.hbm | 5 - harbour/examples/terminal/trm_cli.hbp | 6 + .../terminal/{trm_client.prg => trm_cli.prg} | 56 +------ harbour/examples/terminal/trm_misc.c | 140 ++++++++++++++++++ harbour/examples/terminal/trm_srv.hbp | 6 + .../terminal/{trm_server.prg => trm_srv.prg} | 66 +-------- 16 files changed, 217 insertions(+), 195 deletions(-) create mode 100644 harbour/examples/terminal/trm_app.hbp rename harbour/examples/terminal/{trm_appn.prg => trm_app.prg} (100%) delete mode 100644 harbour/examples/terminal/trm_appn.hbm create mode 100644 harbour/examples/terminal/trm_cli.hbp rename harbour/examples/terminal/{trm_client.prg => trm_cli.prg} (92%) create mode 100644 harbour/examples/terminal/trm_misc.c create mode 100644 harbour/examples/terminal/trm_srv.hbp rename harbour/examples/terminal/{trm_server.prg => trm_srv.prg} (85%) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c910eb329a..247e77e061 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,45 @@ past entries belonging to these authors: Viktor Szakats. */ +2009-05-29 18:04 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * contrib/gtwvg/gtwvg.h + + Added extern for hb_wvt_GetStringAttrib(), hb_wvt_PutStringAttrib(). + Required by terminal example. + + * contrib/gtwvg/wvggui.h + * Comment format. Synced with gtwvg.h. + + - examples/terminal/trm_server.prg + + examples/terminal/trm_srv.prg + - examples/terminal/trm_client.prg + + examples/terminal/trm_cli.prg + - examples/terminal/trm_appn.prg + + examples/terminal/trm_app.prg + - examples/terminal/trm_appn.hbm + + examples/terminal/trm_app.hbp + + examples/terminal/trm_misc.c + + examples/terminal/trm_cli.hbp + + examples/terminal/trm_srv.hbp + * examples/terminal/terminal.prg + * examples/terminal/terminal.hbc + * examples/terminal/readme.txt + ! Removed all inline stuff. + ! Fixed problems with mixing C++/C objects due to + inline and missing function declarations. + % Windows only function replaced with RTL one. + * Renamed *.hbm files to .hbp, so now it's easy to build + the whole project with: hbmk2 trm_app.hbp trm_cli.hbp trm_srv.hbp + ! Fixed hard coded local executable names + dirs. + ! Synced client and server default ports. + ; Now all of these tools build ok and they also work. + + * contrib/hbwin/legacyc.c + ! Deleted recently added compat calls. + (they are static in xhb and they collide with RTL names) + + * examples/hbgf/hbgfgtk/hbgfgtk.hbm + ! Minor fix. + 2009-05-29 17:13 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * utils/hbmk2/hbmk2.prg + Added support for filter keywords 'shared' and 'static'. diff --git a/harbour/contrib/gtwvg/gtwvg.h b/harbour/contrib/gtwvg/gtwvg.h index 939ebafa18..454c49199f 100644 --- a/harbour/contrib/gtwvg/gtwvg.h +++ b/harbour/contrib/gtwvg/gtwvg.h @@ -602,6 +602,8 @@ BOOL HB_EXPORT hb_wvt_gtRenderPicture( int x1, int y1, int wd, int ht, BOOL HB_EXPORT hb_wvt_gtDestroyPicture( IPicture * iPicture ); #endif BOOL HB_EXPORT hb_wvt_DrawImage( HDC hdc, int x1, int y1, int wd, int ht, char * image ); +void HB_EXPORT hb_wvt_GetStringAttrib( USHORT top, USHORT left, USHORT bottom, USHORT right, BYTE * sBuffer, BYTE * sAttrib ); +void HB_EXPORT hb_wvt_PutStringAttrib( USHORT top, USHORT left, USHORT bottom, USHORT right, BYTE * sBuffer, BYTE * sAttrib ); LPWORD HB_EXPORT lpwAlign( LPWORD lpIn ); int HB_EXPORT nCopyAnsiToWideChar( LPWORD lpWCStr, LPSTR lpAnsiIn ); diff --git a/harbour/contrib/gtwvg/wvggui.h b/harbour/contrib/gtwvg/wvggui.h index 51254cf6f1..4ebf1bbcb8 100644 --- a/harbour/contrib/gtwvg/wvggui.h +++ b/harbour/contrib/gtwvg/wvggui.h @@ -170,7 +170,7 @@ HB_EXTERN_BEGIN #endif #if !defined( INITCOMMONCONTROLSEX ) typedef struct tagINITCOMMONCONTROLSEX { - DWORD dwSize; /* size of this structure */ + DWORD dwSize; /* size of this structure */ DWORD dwICC; /* flags indicating which classes to be initialized */ } INITCOMMONCONTROLSEX, *LPINITCOMMONCONTROLSEX; #endif diff --git a/harbour/contrib/hbwin/legacyc.c b/harbour/contrib/hbwin/legacyc.c index cd289e4057..870e129474 100644 --- a/harbour/contrib/hbwin/legacyc.c +++ b/harbour/contrib/hbwin/legacyc.c @@ -137,33 +137,3 @@ HB_FUNC( MESSAGEBOX ) HB_TCHAR_FREE( lpStr1 ); HB_TCHAR_FREE( lpStr2 ); } - -HB_FUNC_EXTERN( WIN_CREATEDC ) ; HB_FUNC( CREATEDC ) { HB_FUNC_EXEC( WIN_CREATEDC ); } -HB_FUNC_EXTERN( WIN_STARTDOC ) ; HB_FUNC( STARTDOC ) { HB_FUNC_EXEC( WIN_STARTDOC ); } -HB_FUNC_EXTERN( WIN_ENDDOC ) ; HB_FUNC( ENDDOC ) { HB_FUNC_EXEC( WIN_ENDDOC ); } -HB_FUNC_EXTERN( WIN_ABORTDOC ) ; HB_FUNC( ABORTDOC ) { HB_FUNC_EXEC( WIN_ABORTDOC ); } -HB_FUNC_EXTERN( WIN_DELETEDC ) ; HB_FUNC( DELETEDC ) { HB_FUNC_EXEC( WIN_DELETEDC ); } -HB_FUNC_EXTERN( WIN_STARTPAGE ) ; HB_FUNC( STARTPAGE ) { HB_FUNC_EXEC( WIN_STARTPAGE ); } -HB_FUNC_EXTERN( WIN_ENDPAGE ) ; HB_FUNC( ENDPAGE ) { HB_FUNC_EXEC( WIN_ENDPAGE ); } -HB_FUNC_EXTERN( WIN_TEXTOUT ) ; HB_FUNC( TEXTOUT ) { HB_FUNC_EXEC( WIN_TEXTOUT ); } -HB_FUNC_EXTERN( WIN_GETTEXTSIZE ) ; HB_FUNC( GETTEXTSIZE ) { HB_FUNC_EXEC( WIN_GETTEXTSIZE ); } -HB_FUNC_EXTERN( WIN_GETCHARSIZE ) ; HB_FUNC( GETCHARSIZE ) { HB_FUNC_EXEC( WIN_GETCHARSIZE ); } -HB_FUNC_EXTERN( WIN_GETDEVICECAPS ) ; HB_FUNC( GETDEVICECAPS ) { HB_FUNC_EXEC( WIN_GETDEVICECAPS ); } -HB_FUNC_EXTERN( WIN_SETMAPMODE ) ; HB_FUNC( SETMAPMODE ) { HB_FUNC_EXEC( WIN_SETMAPMODE ); } -HB_FUNC_EXTERN( WIN_MULDIV ) ; HB_FUNC( MULDIV ) { HB_FUNC_EXEC( WIN_MULDIV ); } -HB_FUNC_EXTERN( WIN_CREATEFONT ) ; HB_FUNC( CREATEFONT ) { HB_FUNC_EXEC( WIN_CREATEFONT ); } -HB_FUNC_EXTERN( WIN_GETPRINTERFONTNAME ) ; HB_FUNC( GETPRINTERFONTNAME ) { HB_FUNC_EXEC( WIN_GETPRINTERFONTNAME ); } -HB_FUNC_EXTERN( WIN_BITMAPSOK ) ; HB_FUNC( BITMAPSOK ) { HB_FUNC_EXEC( WIN_BITMAPSOK ); } -HB_FUNC_EXTERN( WIN_SETDOCUMENTPROPERTIES ) ; HB_FUNC( SETDOCUMENTPROPERTIES ) { HB_FUNC_EXEC( WIN_SETDOCUMENTPROPERTIES ); } -HB_FUNC_EXTERN( WIN_LOADBITMAPFILE ) ; HB_FUNC( LOADBITMAPFILE ) { HB_FUNC_EXEC( WIN_LOADBITMAPFILE ); } -HB_FUNC_EXTERN( WIN_DRAWBITMAP ) ; HB_FUNC( DRAWBITMAP ) { HB_FUNC_EXEC( WIN_DRAWBITMAP ); } -HB_FUNC_EXTERN( WIN_ENUMFONTS ) ; HB_FUNC( ENUMFONTS ) { HB_FUNC_EXEC( WIN_ENUMFONTS ); } -HB_FUNC_EXTERN( WIN_GETEXEFILENAME ) ; HB_FUNC( GETEXEFILENAME ) { HB_FUNC_EXEC( WIN_GETEXEFILENAME ); } -HB_FUNC_EXTERN( WIN_SETCOLOR ) ; HB_FUNC( SETCOLOR ) { HB_FUNC_EXEC( WIN_SETCOLOR ); } -HB_FUNC_EXTERN( WIN_SETPEN ) ; HB_FUNC( SETPEN ) { HB_FUNC_EXEC( WIN_SETPEN ); } -HB_FUNC_EXTERN( WIN_FILLRECT ) ; HB_FUNC( FILLRECT ) { HB_FUNC_EXEC( WIN_FILLRECT ); } -HB_FUNC_EXTERN( WIN_LINETO ) ; HB_FUNC( LINETO ) { HB_FUNC_EXEC( WIN_LINETO ); } -HB_FUNC_EXTERN( WIN_RECTANGLE ) ; HB_FUNC( RECTANGLE ) { HB_FUNC_EXEC( WIN_RECTANGLE ); } -HB_FUNC_EXTERN( WIN_ARC ) ; HB_FUNC( ARC ) { HB_FUNC_EXEC( WIN_ARC ); } -HB_FUNC_EXTERN( WIN_ELLIPSE ) ; HB_FUNC( ELLIPSE ) { HB_FUNC_EXEC( WIN_ELLIPSE ); } -HB_FUNC_EXTERN( WIN_SETBKMODE ) ; HB_FUNC( SETBKMODE ) { HB_FUNC_EXEC( WIN_SETBKMODE ); } diff --git a/harbour/examples/hbgf/hbgfgtk/hbgfgtk.hbm b/harbour/examples/hbgf/hbgfgtk/hbgfgtk.hbm index bd2e2a6748..f7e7576f7f 100644 --- a/harbour/examples/hbgf/hbgfgtk/hbgfgtk.hbm +++ b/harbour/examples/hbgf/hbgfgtk/hbgfgtk.hbm @@ -11,7 +11,7 @@ -inctrypath={linux}/usr/include -inctrypath={linux}/usr/include/glib-2.0 --cflag=`pkg-config --cflags gtk+-2.0` +"-cflag=`pkg-config --cflags gtk+-2.0`" creawin.c general.c diff --git a/harbour/examples/terminal/readme.txt b/harbour/examples/terminal/readme.txt index f0ae3db84c..ec24ee98e8 100644 --- a/harbour/examples/terminal/readme.txt +++ b/harbour/examples/terminal/readme.txt @@ -27,7 +27,7 @@ Terminal Client Link => GTWVG Run => trm_client.exe - + [Parameters - Norammly Supplied to Appln - Separated by SPACE ] [InitDirectory - Harbour Application's Startup Folder ] Mode => ST ( Single Threaded ) @@ -39,7 +39,7 @@ Terminal Client ServerIP = 127.0.0.1 | vouch.dynalias.com ServerPort = 2011 - Application = c:\harbour\contrib\examples\terminal\trm_appn.exe + Application = c:\harbour\contrib\examples\terminal\trm_app.exe Parameters = any number of parameters separated by a space InitDirectory = Complete Folder path from where Harbour Appln will be invoked. @@ -49,7 +49,7 @@ Terminal Client Harbour Application =================== - Source(s) => trm_appn.prg | Your program sources + + Source(s) => trm_app.prg | Your program sources + terminal.prg + terminal.ch Link => GTWVG @@ -129,4 +129,3 @@ The Bottom Line Regards Pritpal Bedi a student of software analysis & design - diff --git a/harbour/examples/terminal/terminal.hbc b/harbour/examples/terminal/terminal.hbc index 262e9a8d83..739085da3a 100644 --- a/harbour/examples/terminal/terminal.hbc +++ b/harbour/examples/terminal/terminal.hbc @@ -2,6 +2,7 @@ # $Id$ # -{win}libs=gtwvg hbwin xhb comdlg32 comctl32 shell32 ole32 oleaut32 +incpaths=../../contrib/gtwvg +{win}libs=gtwvg hbwin xhb mt=yes gui=yes diff --git a/harbour/examples/terminal/terminal.prg b/harbour/examples/terminal/terminal.prg index f4eda0882a..0afc2d1912 100644 --- a/harbour/examples/terminal/terminal.prg +++ b/harbour/examples/terminal/terminal.prg @@ -92,30 +92,6 @@ STATIC srvrSocket STATIC commSocket STATIC lSendingClient := .f. -//----------------------------------------------------------------------// -#pragma BEGINDUMP - -#include "hbapi.h" -#include "hbgtcore.h" - -#include - -#if 0 -#define TIMER_RECEIVE 1001 -#define TIMER_SEND 1002 -#define TIMER_PING 1010 -#endif - -HB_FUNC( OUTPUTDEBUGSTRING ) -{ - OutputDebugString( hb_parc( 1 ) ); -} - -extern void hb_wvt_GetStringAttrib( USHORT, USHORT left, USHORT bottom, USHORT right, BYTE * sBuffer, BYTE * sAttrib ); - -#pragma ENDDUMP -//----------------------------------------------------------------------// - Function RmtSvrInitialize( cServerInfo, nTimeoutClient, nTimeRefresh ) Local lExit := .t. Local nTimeOut := 50 // PICK FROM EXTERNASL SOURCE @@ -252,22 +228,7 @@ Function RmtSvrSendClient( nMode, xData ) cOdd := "" cEvn := "" - HB_INLINE( TOP,LFT,BTM,RGT,@cOdd,@cEvn ){ - ULONG uiSize; - void * pBuffer; - void * qBuffer; - - hb_gtRectSize( hb_parnl( 1 ),hb_parnl( 2 ),hb_parnl( 3 ),hb_parnl( 4 ),&uiSize ); - pBuffer = hb_xgrab( (uiSize/2)+1 ); - qBuffer = hb_xgrab( (uiSize/2)+1 ); - - hb_wvt_GetStringAttrib( hb_parnl( 1 ),hb_parnl( 2 ),hb_parnl( 3 ),hb_parnl( 4 ), pBuffer, qBuffer ); - hb_storclen( pBuffer, (uiSize/2), 5 ); - hb_storclen( qBuffer, (uiSize/2), 6 ); - - hb_xfree( pBuffer ); - hb_xfree( qBuffer ); - } + GETSCREENATTRIB( TOP,LFT,BTM,RGT,@cOdd,@cEvn ) if !( cSOdd == cOdd ) .or. !( cSEvn == cEvn ) lSendScrn := .t. diff --git a/harbour/examples/terminal/trm_app.hbp b/harbour/examples/terminal/trm_app.hbp new file mode 100644 index 0000000000..2e7d7c7583 --- /dev/null +++ b/harbour/examples/terminal/trm_app.hbp @@ -0,0 +1,7 @@ +# +# $Id$ +# + +trm_app.prg +terminal.prg +trm_misc.c diff --git a/harbour/examples/terminal/trm_appn.prg b/harbour/examples/terminal/trm_app.prg similarity index 100% rename from harbour/examples/terminal/trm_appn.prg rename to harbour/examples/terminal/trm_app.prg diff --git a/harbour/examples/terminal/trm_appn.hbm b/harbour/examples/terminal/trm_appn.hbm deleted file mode 100644 index d3bc563e61..0000000000 --- a/harbour/examples/terminal/trm_appn.hbm +++ /dev/null @@ -1,5 +0,0 @@ -# -# $Id$ -# - -trm_appn.prg terminal.prg diff --git a/harbour/examples/terminal/trm_cli.hbp b/harbour/examples/terminal/trm_cli.hbp new file mode 100644 index 0000000000..dd276b1c58 --- /dev/null +++ b/harbour/examples/terminal/trm_cli.hbp @@ -0,0 +1,6 @@ +# +# $Id: trm_appn.hbm 10405 2009-02-22 17:34:06Z vszakats $ +# + +trm_cli.prg +trm_misc.c diff --git a/harbour/examples/terminal/trm_client.prg b/harbour/examples/terminal/trm_cli.prg similarity index 92% rename from harbour/examples/terminal/trm_client.prg rename to harbour/examples/terminal/trm_cli.prg index 59afffe05e..2ac70e8930 100644 --- a/harbour/examples/terminal/trm_client.prg +++ b/harbour/examples/terminal/trm_cli.prg @@ -102,32 +102,6 @@ static lTraceLog := .f. static nTrace := 0 static aDat := { {"",""} } -//----------------------------------------------------------------------// -#pragma BEGINDUMP -//----------------------------------------------------------------------// - -#include "hbapi.h" -#include "hbapigt.h" - -HB_EXTERN_BEGIN - -extern void hb_wvt_GetStringAttrib( USHORT top, USHORT left, USHORT bottom, USHORT right, BYTE * sBuffer, BYTE * sAttrib ); -extern void hb_wvt_PutStringAttrib( USHORT top, USHORT left, USHORT bottom, USHORT right, BYTE * sBuffer, BYTE * sAttrib ); - -HB_EXTERN_END - -#include -HB_FUNC( OUTPUTDEBUGSTRING ) -{ - LPTSTR text = HB_TCHAR_CONVTO( hb_parc( 1 ) ); - OutputDebugString( text ); - HB_TCHAR_FREE( text ); -} - -//----------------------------------------------------------------------// -#pragma ENDDUMP -//----------------------------------------------------------------------// - Function Main( cAddress, cPort, cAppln, cParams, cDirectory ) LOCAL Socket, n, cText, cResponse, nThread, hMutex, hMutex1 @@ -201,16 +175,7 @@ STATIC FUNCTION ResolveParams( cAddress, cPort, cAppln, cParams, cDirectory ) cFile := "vclient.ini" endif - cPath := HB_INLINE(){ - int iSize; - TCHAR buffer[ MAX_PATH ]; - - iSize = GetModuleFileName( NULL, buffer, MAX_PATH ); - if( iSize > 0 ) - hb_retc( HB_TCHAR_CONVFROM( buffer ) ); - else - hb_retc( NULL ); - } + cPath := hb_DirBase() if !empty( cPath ) n := rat( "\", cPath ) @@ -220,7 +185,7 @@ STATIC FUNCTION ResolveParams( cAddress, cPort, cAppln, cParams, cDirectory ) endif cFile := cPath + cFile - lFile := file( cFile ) + lFile := hb_FileExists( cFile ) if empty( cAddress ) .and. lFile alert( "File found: "+cFile ) @@ -268,11 +233,11 @@ STATIC FUNCTION ResolveParams( cAddress, cPort, cAppln, cParams, cDirectory ) // Defaults to Vouch Server // if empty( cAddress ) - cAddress := "vouch.dynalias.com" - cPort := "2011" - cAppln := "\Creative.acp\VouchRMT\Vouch.exe" - cParams := "\creative.dat\vouchsvr" - cDirectory := "\Creative.acp\VouchRMT\" + cAddress := "localhost" + cPort := "8085" + cAppln := "trm_app.exe" + cParams := "" + cDirectory := hb_DirBase() endif if empty( cParams ) @@ -375,12 +340,7 @@ Function TrmReceiveServer() cEvn1 := substr( a_[ 2 ], b_[ 5 ]+1 ) cEvn := hb_uncompress( n, cEvn1 ) - HB_INLINE( b_[ 1 ], b_[ 2 ], b_[ 3 ], b_[ 4 ], cOdd, cEvn ){ - hb_wvt_PutStringAttrib( hb_parnl( 1 ), hb_parnl( 2 ), - hb_parnl( 3 ), hb_parnl( 4 ), - ( BYTE* ) hb_parc( 5 ), - ( BYTE* ) hb_parc( 6 ) ); - } + PUTSCREENATTRIB( b_[ 1 ], b_[ 2 ], b_[ 3 ], b_[ 4 ], cOdd, cEvn ) case cCommand == "CRS" a_:= hb_aTokens( @cData, ";" ) diff --git a/harbour/examples/terminal/trm_misc.c b/harbour/examples/terminal/trm_misc.c new file mode 100644 index 0000000000..fa20883b49 --- /dev/null +++ b/harbour/examples/terminal/trm_misc.c @@ -0,0 +1,140 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * + * Copyright 2009 Pritpal Bedi + * http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#define HB_OS_WIN_USED + +#include "hbapi.h" + +#include "gtwvg.h" + +#include + +// CreateProcess( cExe, cCmdLineArgs, nFlags, cEnvPair, cInitDirectory, @aProcessInfo ) +// +HB_FUNC( CREATEPROCESS ) +{ + LPCTSTR lpApplicationName; // name of executable module + LPTSTR lpCommandLine; // command line string + LPSECURITY_ATTRIBUTES lpProcessAttributes; // SD + LPSECURITY_ATTRIBUTES lpThreadAttributes; // SD + BOOL bInheritHandles; // handle inheritance option + DWORD dwCreationFlags; // creation flags + LPVOID lpEnvironment; // new environment block + LPCTSTR lpCurrentDirectory; // current directory name + LPSTARTUPINFO lpStartupInfo; // startup information + LPPROCESS_INFORMATION lpProcessInformation; // process information + + lpApplicationName = NULL;//hb_parc( 1 ); + lpCommandLine = hb_parc( 1 ); + lpProcessAttributes = NULL; + lpThreadAttributes = NULL; + bInheritHandles = TRUE; + dwCreationFlags = 0; //ISNUM( 3 ) ? hb_parnl( 3 ) : CREATE_NEW_CONSOLE; + lpEnvironment = NULL; //ISCHAR( 4 ) ? hb_parc( 4 ) : NULL; + lpCurrentDirectory = NULL; //ISCHAR( 5 ) ? hb_parc( 5 ) : NULL; + lpStartupInfo = NULL; + + hb_retl( + CreateProcess( + lpApplicationName, + lpCommandLine, + lpProcessAttributes, + lpThreadAttributes, + bInheritHandles, + dwCreationFlags, + lpEnvironment, + lpCurrentDirectory, + lpStartupInfo, + NULL ) ); +} + +HB_FUNC( SHELLEXECUTE ) +{ + ShellExecute( NULL, + "OPEN", + hb_parc( 1 ), + hb_parc( 2 ), + hb_parc( 3 ), + SW_SHOWNORMAL ); +} + +HB_FUNC( OUTPUTDEBUGSTRING ) +{ + LPTSTR text = HB_TCHAR_CONVTO( hb_parc( 1 ) ); + OutputDebugString( text ); + HB_TCHAR_FREE( text ); +} + +HB_FUNC( GETSCREENATTRIB ) +{ + ULONG uiSize; + void * pBuffer; + void * qBuffer; + + hb_gtRectSize( hb_parnl( 1 ),hb_parnl( 2 ),hb_parnl( 3 ),hb_parnl( 4 ),&uiSize ); + pBuffer = hb_xgrab( (uiSize/2)+1 ); + qBuffer = hb_xgrab( (uiSize/2)+1 ); + + hb_wvt_GetStringAttrib( hb_parnl( 1 ),hb_parnl( 2 ),hb_parnl( 3 ),hb_parnl( 4 ), pBuffer, qBuffer ); + hb_storclen( pBuffer, (uiSize/2), 5 ); + hb_storclen( qBuffer, (uiSize/2), 6 ); + + hb_xfree( pBuffer ); + hb_xfree( qBuffer ); +} + +HB_FUNC( PUTSCREENATTRIB ) +{ + hb_wvt_PutStringAttrib( hb_parnl( 1 ), hb_parnl( 2 ), + hb_parnl( 3 ), hb_parnl( 4 ), + ( BYTE* ) hb_parc( 5 ), + ( BYTE* ) hb_parc( 6 ) ); +} diff --git a/harbour/examples/terminal/trm_srv.hbp b/harbour/examples/terminal/trm_srv.hbp new file mode 100644 index 0000000000..d25ce8d277 --- /dev/null +++ b/harbour/examples/terminal/trm_srv.hbp @@ -0,0 +1,6 @@ +# +# $Id: trm_appn.hbm 10405 2009-02-22 17:34:06Z vszakats $ +# + +trm_srv.prg +trm_misc.c diff --git a/harbour/examples/terminal/trm_server.prg b/harbour/examples/terminal/trm_srv.prg similarity index 85% rename from harbour/examples/terminal/trm_server.prg rename to harbour/examples/terminal/trm_srv.prg index 3c7a407012..57bec2b596 100644 --- a/harbour/examples/terminal/trm_server.prg +++ b/harbour/examples/terminal/trm_srv.prg @@ -198,7 +198,7 @@ PROCEDURE ServeClient( Socket ) do case case cReq == 'AR' nServerPort++ - SvrExecuteAPP( 'C:\DEV\C5\BIN\AR32.EXE', ltrim( str( nServerPort++ ) ), 'R:\ARTEST\' ) + SvrExecuteAPP( 'trm_app.exe', ltrim( str( nServerPort++ ) ), hb_dirBase() ) inkey( 5 ) cReply := 'CONNECT;'+'127.0.0.1'+';'+ltrim( str( nServerPort++ ) )+';' @@ -451,67 +451,3 @@ Function uiXtos( xVar ) Function HB_GTSYS() REQUEST HB_GT_WVG_DEFAULT Return nil - -//----------------------------------------------------------------------// -#pragma BEGINDUMP - -#include "hbapi.h" -#include -#include - -// CreateProcess( cExe, cCmdLineArgs, nFlags, cEnvPair, cInitDirectory, @aProcessInfo ) -// -HB_FUNC( CREATEPROCESS ) -{ - LPCTSTR lpApplicationName; // name of executable module - LPTSTR lpCommandLine; // command line string - LPSECURITY_ATTRIBUTES lpProcessAttributes; // SD - LPSECURITY_ATTRIBUTES lpThreadAttributes; // SD - BOOL bInheritHandles; // handle inheritance option - DWORD dwCreationFlags; // creation flags - LPVOID lpEnvironment; // new environment block - LPCTSTR lpCurrentDirectory; // current directory name - LPSTARTUPINFO lpStartupInfo; // startup information - LPPROCESS_INFORMATION lpProcessInformation; // process information - - lpApplicationName = NULL;//hb_parc( 1 ); - lpCommandLine = hb_parc( 1 ); - lpProcessAttributes = NULL; - lpThreadAttributes = NULL; - bInheritHandles = TRUE; - dwCreationFlags = NULL; //ISNUM( 3 ) ? hb_parnl( 3 ) : CREATE_NEW_CONSOLE; - lpEnvironment = NULL; //ISCHAR( 4 ) ? hb_parc( 4 ) : NULL; - lpCurrentDirectory = NULL; //ISCHAR( 5 ) ? hb_parc( 5 ) : NULL; - lpStartupInfo = NULL; - - hb_retl( - CreateProcess( - lpApplicationName, - lpCommandLine, - lpProcessAttributes, - lpThreadAttributes, - bInheritHandles, - dwCreationFlags, - lpEnvironment, - lpCurrentDirectory, - lpStartupInfo, - NULL ) ); -} - -HB_FUNC( SHELLEXECUTE ) -{ - ShellExecute( NULL, - "OPEN", - hb_parc( 1 ), - hb_parc( 2 ), - hb_parc( 3 ), - SW_SHOWNORMAL ); -} - -HB_FUNC( OUTPUTDEBUGSTRING ) -{ - OutputDebugString( hb_parc( 1 ) ); -} - -#pragma ENDDUMP -//----------------------------------------------------------------------//