From a9d571c7358f8d11f1f45ec0b60434b0f109373a Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Wed, 2 Jul 2008 09:57:58 +0000 Subject: [PATCH] 2008-07-02 11:57 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/xhb/Makefile * harbour/contrib/xhb/common.mak - harbour/contrib/xhb/hbchksum.c * removed HB_CHECKSUM() code - it's not necessary * harbour/contrib/xhb/xhbfunc.c + redirected HB_CHECKSUM() to HB_ADLER32() * harbour/source/rtl/gtwvt/gtwvt.c ! fixed WINCE builds. It was only for MiGWCE which partially emulates GetSystemMenu() but probably other builds will report that this function is missing. If possible please test if current Harbour application can be executed in real WinCE environment. * harbour/make_deb.sh * updated contrib library list * harbour/contrib/hbmysql/mysql.c ! fixed compilation for older MYSQL versions * harbour/contrib/gtwvg/gtwvg.c * harbour/contrib/gtwvg/wvgutils.c ! fixed UNICODE builds + harbour/config/none.cf + added dummy header file for GNU make to avoid errors on unsupported platforms * harbour/contrib/hbw32ddr/Makefile * harbour/contrib/hbmysql/Makefile * harbour/contrib/hbodbc/Makefile * harbour/contrib/hbwhat32/Makefile * harbour/contrib/hbtpathy/Makefile * harbour/contrib/hbw32/Makefile * harbour/contrib/hbole/Makefile * harbour/contrib/hbapollo/Makefile * harbour/contrib/hbfbird/Makefile * harbour/contrib/hbziparch/Makefile * harbour/contrib/hbcurl/Makefile * harbour/contrib/hbhpdf/Makefile * harbour/contrib/rddado/Makefile * harbour/contrib/gtwvg/Makefile * harbour/contrib/hbpgsql/Makefile * harbour/contrib/rddads/Makefile * harbour/contrib/hbfimage/Makefile * harbour/contrib/hbgd/Makefile * harbour/contrib/hbgf/hbgfw32/Makefile * harbour/contrib/hbgf/hbgfos2/Makefile * harbour/contrib/hbgf/hbgfgtk/Makefile * harbour/contrib/hbtip/Makefile * harbour/contrib/hbbmcdx/Makefile * updated to not generate errors for unsupported builds --- harbour/ChangeLog | 55 +++++++++++ harbour/config/none.cf | 21 +++++ harbour/contrib/gtwvg/Makefile | 10 +- harbour/contrib/gtwvg/gtwvg.c | 2 +- harbour/contrib/gtwvg/wvgutils.c | 8 +- harbour/contrib/hbapollo/Makefile | 11 +-- harbour/contrib/hbbmcdx/Makefile | 4 - harbour/contrib/hbcurl/Makefile | 10 +- harbour/contrib/hbfbird/Makefile | 10 +- harbour/contrib/hbfimage/Makefile | 10 +- harbour/contrib/hbgd/Makefile | 10 +- harbour/contrib/hbgf/hbgfgtk/Makefile | 14 +-- harbour/contrib/hbgf/hbgfos2/Makefile | 10 +- harbour/contrib/hbgf/hbgfw32/Makefile | 10 +- harbour/contrib/hbhpdf/Makefile | 10 +- harbour/contrib/hbmysql/Makefile | 10 +- harbour/contrib/hbmysql/mysql.c | 21 +++++ harbour/contrib/hbodbc/Makefile | 16 ++-- harbour/contrib/hbole/Makefile | 10 +- harbour/contrib/hbpgsql/Makefile | 10 +- harbour/contrib/hbtip/Makefile | 10 +- harbour/contrib/hbtpathy/Makefile | 10 +- harbour/contrib/hbw32/Makefile | 12 +-- harbour/contrib/hbw32ddr/Makefile | 10 +- harbour/contrib/hbwhat32/Makefile | 10 +- harbour/contrib/hbziparch/Makefile | 21 +++-- harbour/contrib/rddado/Makefile | 5 - harbour/contrib/rddads/Makefile | 10 +- harbour/contrib/xhb/Makefile | 1 - harbour/contrib/xhb/common.mak | 1 - harbour/contrib/xhb/hbchksum.c | 131 -------------------------- harbour/contrib/xhb/xhbfunc.c | 7 ++ harbour/make_deb.sh | 12 ++- harbour/source/rtl/gtwvt/gtwvt.c | 57 ++++++----- 34 files changed, 295 insertions(+), 264 deletions(-) create mode 100644 harbour/config/none.cf delete mode 100644 harbour/contrib/xhb/hbchksum.c diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b6fa137b7f..808cb31234 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,61 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-07-02 11:57 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/contrib/xhb/Makefile + * harbour/contrib/xhb/common.mak + - harbour/contrib/xhb/hbchksum.c + * removed HB_CHECKSUM() code - it's not necessary + + * harbour/contrib/xhb/xhbfunc.c + + redirected HB_CHECKSUM() to HB_ADLER32() + + * harbour/source/rtl/gtwvt/gtwvt.c + ! fixed WINCE builds. It was only for MiGWCE which partially emulates + GetSystemMenu() but probably other builds will report that this + function is missing. + If possible please test if current Harbour application can be + executed in real WinCE environment. + + * harbour/make_deb.sh + * updated contrib library list + + * harbour/contrib/hbmysql/mysql.c + ! fixed compilation for older MYSQL versions + + * harbour/contrib/gtwvg/gtwvg.c + * harbour/contrib/gtwvg/wvgutils.c + ! fixed UNICODE builds + + + harbour/config/none.cf + + added dummy header file for GNU make to avoid errors on unsupported + platforms + + * harbour/contrib/hbw32ddr/Makefile + * harbour/contrib/hbmysql/Makefile + * harbour/contrib/hbodbc/Makefile + * harbour/contrib/hbwhat32/Makefile + * harbour/contrib/hbtpathy/Makefile + * harbour/contrib/hbw32/Makefile + * harbour/contrib/hbole/Makefile + * harbour/contrib/hbapollo/Makefile + * harbour/contrib/hbfbird/Makefile + * harbour/contrib/hbziparch/Makefile + * harbour/contrib/hbcurl/Makefile + * harbour/contrib/hbhpdf/Makefile + * harbour/contrib/rddado/Makefile + * harbour/contrib/gtwvg/Makefile + * harbour/contrib/hbpgsql/Makefile + * harbour/contrib/rddads/Makefile + * harbour/contrib/hbfimage/Makefile + * harbour/contrib/hbgd/Makefile + * harbour/contrib/hbgf/hbgfw32/Makefile + * harbour/contrib/hbgf/hbgfos2/Makefile + * harbour/contrib/hbgf/hbgfgtk/Makefile + * harbour/contrib/hbtip/Makefile + * harbour/contrib/hbbmcdx/Makefile + * updated to not generate errors for unsupported builds + 2008-07-02 11:21 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * include/hbdefs.h ! Fixed DLL creation for MSVC (and maybe compilers, too). diff --git a/harbour/config/none.cf b/harbour/config/none.cf new file mode 100644 index 0000000000..70e15ca74b --- /dev/null +++ b/harbour/config/none.cf @@ -0,0 +1,21 @@ +# +# $Id$ +# + +ifneq ($(HB_ARCHITECTURE),) +ifneq ($(HB_COMPILER),) + +ifneq ($(LIBNAME),) + DIR_RULE := @echo "The '$(LIBNAME)' library ignored." +else + DIR_RULE := +endif + +all : first + + +first clean install:: + $(DIR_RULE) + +endif +endif diff --git a/harbour/contrib/gtwvg/Makefile b/harbour/contrib/gtwvg/Makefile index 5b3eba85a0..638c0eb7c2 100644 --- a/harbour/contrib/gtwvg/Makefile +++ b/harbour/contrib/gtwvg/Makefile @@ -2,10 +2,12 @@ # $Id$ # -ifeq ($(HB_ARCHITECTURE),w32) - ROOT = ../../ +LIBNAME=gtwvg + +ifeq ($(HB_ARCHITECTURE),w32) + C_SOURCES=\ gtwvg.c \ wvgcore.c \ @@ -19,8 +21,6 @@ PRG_HEADERS=\ hbgtwvg.ch \ wvtwin.ch \ -LIBNAME=gtwvg - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf @@ -28,4 +28,6 @@ include $(TOP)$(ROOT)config/lib.cf install:: $(INSTALL_RULE_HEADERS) +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/gtwvg/gtwvg.c b/harbour/contrib/gtwvg/gtwvg.c index 71b34885bf..1daaae933c 100644 --- a/harbour/contrib/gtwvg/gtwvg.c +++ b/harbour/contrib/gtwvg/gtwvg.c @@ -2705,7 +2705,7 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) tnid.uCallbackMessage = HB_MSG_NOTIFYICON; tnid.hIcon = hIcon ; - lstrcpyn( tnid.szTip, hb_arrayGetCPtr( pInfo->pNewVal2, 4 ), sizeof( tnid.szTip ) ) ; + HB_TCHAR_CPTO( tnid.szTip, hb_arrayGetCPtr( pInfo->pNewVal2, 4 ), sizeof( tnid.szTip ) - 1 ); Shell_NotifyIcon( mode, &tnid ) ; diff --git a/harbour/contrib/gtwvg/wvgutils.c b/harbour/contrib/gtwvg/wvgutils.c index 290f5c0aa4..af2429e9ed 100644 --- a/harbour/contrib/gtwvg/wvgutils.c +++ b/harbour/contrib/gtwvg/wvgutils.c @@ -2153,7 +2153,13 @@ HB_FUNC( WIN_CHOOSECOLOR ) HB_FUNC( WIN_FINDWINDOW ) { - HWND hwnd = FindWindow( NULL, hb_parc( 1 ) ); + HWND hwnd; + LPTSTR lpStr; + + lpStr = HB_TCHAR_CONVTO( hb_parc( 1 ) ); + hwnd = FindWindow( NULL, lpStr ); + HB_TCHAR_FREE( lpStr ); + if ( hwnd ) { hb_retnl( (LONG) hwnd ); diff --git a/harbour/contrib/hbapollo/Makefile b/harbour/contrib/hbapollo/Makefile index 78a4868079..b5af67ff6e 100644 --- a/harbour/contrib/hbapollo/Makefile +++ b/harbour/contrib/hbapollo/Makefile @@ -2,7 +2,9 @@ # $Id$ # -ifeq ($(HB_ARCHITECTURE),w32) +ROOT = ../../ + +LIBNAME=hbapollo HB_INC_APOLLO_OK += $(foreach d, $(HB_INC_APOLLO), $(if $(wildcard $(d)/sde61.h),$(d),)) @@ -10,8 +12,6 @@ ifneq ($(strip $(HB_INC_APOLLO_OK)),) C_USR += $(foreach d, $(HB_INC_APOLLO_OK), -I$(d)) -ROOT = ../../ - C_SOURCES=\ apollo.c \ @@ -21,8 +21,6 @@ PRG_SOURCES=\ PRG_HEADERS=\ apollo.ch \ -LIBNAME=hbapollo - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf @@ -30,5 +28,6 @@ include $(TOP)$(ROOT)config/lib.cf install:: $(INSTALL_RULE_HEADERS) -endif +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbbmcdx/Makefile b/harbour/contrib/hbbmcdx/Makefile index a2f5d56807..3fea8982b1 100644 --- a/harbour/contrib/hbbmcdx/Makefile +++ b/harbour/contrib/hbbmcdx/Makefile @@ -2,8 +2,6 @@ # $Id$ # -ifneq ($(HB_ARCHITECTURE),dos) - ROOT = ../../ C_SOURCES=\ @@ -13,5 +11,3 @@ C_SOURCES=\ LIBNAME=hbbmcdx include $(TOP)$(ROOT)config/lib.cf - -endif diff --git a/harbour/contrib/hbcurl/Makefile b/harbour/contrib/hbcurl/Makefile index fa3f2f4592..7ab73b7f63 100644 --- a/harbour/contrib/hbcurl/Makefile +++ b/harbour/contrib/hbcurl/Makefile @@ -2,6 +2,10 @@ # $Id$ # +ROOT = ../../ + +LIBNAME=hbcurl + ifeq ($(HB_INC_CURL),) HB_INC_CURL = /usr/include endif @@ -12,16 +16,12 @@ ifneq ($(strip $(HB_INC_CURL_OK)),) C_USR += $(foreach d, $(HB_INC_CURL_OK), -I$(d)) -ROOT = ../../ - C_SOURCES=\ hbcurl.c \ PRG_HEADERS=\ hbcurl.ch \ -LIBNAME=hbcurl - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf @@ -29,4 +29,6 @@ include $(TOP)$(ROOT)config/lib.cf install:: $(INSTALL_RULE_HEADERS) +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbfbird/Makefile b/harbour/contrib/hbfbird/Makefile index bbdbe1de3b..a7b66dd06b 100644 --- a/harbour/contrib/hbfbird/Makefile +++ b/harbour/contrib/hbfbird/Makefile @@ -2,6 +2,10 @@ # $Id$ # +ROOT = ../../ + +LIBNAME=hbfbird + ifeq ($(HB_INC_FIREBIRD),) HB_INC_FIREBIRD = /usr/include /opt/firebird/include endif @@ -12,16 +16,14 @@ ifneq ($(strip $(HB_INC_FIREBIRD_OK)),) C_USR += $(foreach d, $(HB_INC_FIREBIRD_OK), -I$(d)) -ROOT = ../../ - C_SOURCES=\ firebird.c \ PRG_SOURCES=\ tfirebird.prg \ -LIBNAME=hbfbird - include $(TOP)$(ROOT)config/lib.cf +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbfimage/Makefile b/harbour/contrib/hbfimage/Makefile index 781b6e5ed8..4b6e030a5c 100644 --- a/harbour/contrib/hbfimage/Makefile +++ b/harbour/contrib/hbfimage/Makefile @@ -2,6 +2,10 @@ # $Id$ # +ROOT = ../../ + +LIBNAME=hbfimage + ifeq ($(HB_INC_FREEIMAGE),) HB_INC_FREEIMAGE = /usr/include endif @@ -12,8 +16,6 @@ ifneq ($(strip $(HB_INC_FREEIMAGE_OK)),) C_USR += $(foreach d, $(HB_INC_FREEIMAGE_OK), -I$(d)) -ROOT = ../../ - C_SOURCES = \ fi_winfu.c \ fi_wrp.c \ @@ -23,8 +25,6 @@ PRG_SOURCES= \ PRG_HEADERS=\ freeimage.ch \ -LIBNAME=hbfimage - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf @@ -32,4 +32,6 @@ include $(TOP)$(ROOT)config/lib.cf install:: $(INSTALL_RULE_HEADERS) +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbgd/Makefile b/harbour/contrib/hbgd/Makefile index 5f21cb828c..2edaef5328 100644 --- a/harbour/contrib/hbgd/Makefile +++ b/harbour/contrib/hbgd/Makefile @@ -2,6 +2,10 @@ # $Id$ # +ROOT = ../../ + +LIBNAME=hbgd + ifeq ($(HB_INC_GD),) HB_INC_GD = /usr/include /opt/local/include endif @@ -12,8 +16,6 @@ ifneq ($(strip $(HB_INC_GD_OK)),) C_USR += $(foreach d, $(HB_INC_GD_OK), -I$(d)) -ROOT = ../../ - C_SOURCES=\ gdwrp.c \ @@ -28,8 +30,6 @@ PRG_SOURCES=\ gdimage.prg \ gdbarcod.prg \ -LIBNAME=hbgd - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf @@ -37,4 +37,6 @@ include $(TOP)$(ROOT)config/lib.cf install:: $(INSTALL_RULE_HEADERS) +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbgf/hbgfgtk/Makefile b/harbour/contrib/hbgf/hbgfgtk/Makefile index 612fbb465a..fc89d3417c 100644 --- a/harbour/contrib/hbgf/hbgfgtk/Makefile +++ b/harbour/contrib/hbgf/hbgfgtk/Makefile @@ -2,21 +2,24 @@ # $Id$ # +ROOT = ../../../ + +LIBNAME=hbgfgtk + ifeq ($(HB_ARCHITECTURE),linux) ifeq ($(HB_INC_GTK),) HB_INC_GTK = /usr/include endif - HB_INC_GTK_OK += $(foreach d, $(HB_INC_GTK), $(if $(wildcard $(d)/glib.h),$(d),)) +endif + ifneq ($(strip $(HB_INC_GTK_OK)),) C_USR += $(foreach d, $(HB_INC_GTK_OK), -I$(d)) C_USR += `pkg-config --cflags gtk+-2.0` -ROOT = ../../../ - C_SOURCES=\ creawin.c \ general.c \ @@ -33,9 +36,8 @@ PRG_SOURCES=\ menuitem.prg \ winctrl.prg \ -LIBNAME=hbgfgtk - include $(TOP)$(ROOT)config/lib.cf -endif +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbgf/hbgfos2/Makefile b/harbour/contrib/hbgf/hbgfos2/Makefile index c255c440c8..65c828c4f8 100644 --- a/harbour/contrib/hbgf/hbgfos2/Makefile +++ b/harbour/contrib/hbgf/hbgfos2/Makefile @@ -2,10 +2,12 @@ # $Id$ # -ifeq ($(HB_ARCHITECTURE),os2) - ROOT = ../../../ +LIBNAME=hbgfos2 + +ifeq ($(HB_ARCHITECTURE),os2) + C_SOURCES=\ os2pm.c \ @@ -17,8 +19,8 @@ PRG_SOURCES=\ button.prg \ edit.prg \ -LIBNAME=hbgfos2 - include $(TOP)$(ROOT)config/lib.cf +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbgf/hbgfw32/Makefile b/harbour/contrib/hbgf/hbgfw32/Makefile index be46ec94fd..b34a0b41fe 100644 --- a/harbour/contrib/hbgf/hbgfw32/Makefile +++ b/harbour/contrib/hbgf/hbgfw32/Makefile @@ -2,10 +2,12 @@ # $Id$ # -ifeq ($(HB_ARCHITECTURE),w32) - ROOT = ../../../ +LIBNAME=hbgfw32 + +ifeq ($(HB_ARCHITECTURE),w32) + C_SOURCES=\ win32.c \ @@ -17,8 +19,8 @@ PRG_SOURCES=\ menuitem.prg \ winctrl.prg \ -LIBNAME=hbgfw32 - include $(TOP)$(ROOT)config/lib.cf +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbhpdf/Makefile b/harbour/contrib/hbhpdf/Makefile index 144e8a7c3e..6caff2d548 100644 --- a/harbour/contrib/hbhpdf/Makefile +++ b/harbour/contrib/hbhpdf/Makefile @@ -2,6 +2,10 @@ # $Id$ # +ROOT = ../../ + +LIBNAME=hbhpdf + ifeq ($(HB_INC_LIBHARU),) HB_INC_LIBHARU = /usr/include endif @@ -12,8 +16,6 @@ ifneq ($(strip $(HB_INC_LIBHARU_OK)),) C_USR += $(foreach d, $(HB_INC_LIBHARU_OK), -I$(d)) -ROOT = ../../ - C_SOURCES=\ harupdf.c \ @@ -22,8 +24,6 @@ PRG_HEADERS=\ PRG_SOURCES=\ -LIBNAME=hbhpdf - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf @@ -31,4 +31,6 @@ include $(TOP)$(ROOT)config/lib.cf install:: $(INSTALL_RULE_HEADERS) +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbmysql/Makefile b/harbour/contrib/hbmysql/Makefile index 315016c88c..6ed30b8353 100644 --- a/harbour/contrib/hbmysql/Makefile +++ b/harbour/contrib/hbmysql/Makefile @@ -2,6 +2,10 @@ # $Id$ # +ROOT = ../../ + +LIBNAME=hbmysql + ifeq ($(HB_INC_MYSQL),) HB_INC_MYSQL = /usr/include/mysql endif @@ -12,8 +16,6 @@ ifneq ($(strip $(HB_INC_MYSQL_OK)),) C_USR += $(foreach d, $(HB_INC_MYSQL_OK), -I$(d)) -ROOT = ../../ - C_SOURCES=\ mysql.c \ @@ -24,8 +26,6 @@ PRG_SOURCES=\ PRG_HEADERS=\ mysql.ch \ -LIBNAME=hbmysql - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf @@ -33,4 +33,6 @@ include $(TOP)$(ROOT)config/lib.cf install:: $(INSTALL_RULE_HEADERS) +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbmysql/mysql.c b/harbour/contrib/hbmysql/mysql.c index c9b272dd8c..38a1862c56 100644 --- a/harbour/contrib/hbmysql/mysql.c +++ b/harbour/contrib/hbmysql/mysql.c @@ -80,7 +80,20 @@ HB_FUNC( SQLVERSION ) /* long mysql_get_server_version( MYSQL * ) */ { +#if MYSQL_VERSION_ID > 32399 hb_retnl( ( long ) mysql_get_server_version( ( MYSQL * ) HB_PARPTR( 1 ) ) ); +#else + const char * szVer = mysql_get_server_info( ( MYSQL * ) HB_PARPTR( 1 ) ); + long lVer = 0; + + while( *szVer ) + { + if( *szVer >= '0' && *szVer <= '9' ) + lVer = lVer * 10 + *szVer; + szVer++; + } + hb_retnl( lVer ); +#endif } HB_FUNC( SQLCONNECT ) /* MYSQL *mysql_real_connect(MYSQL*, char * host, char * user, char * password, char * db, uint port, char *, uint flags) */ @@ -120,12 +133,20 @@ HB_FUNC( SQLCLOSE ) /* void mysql_close(MYSQL *mysql) */ HB_FUNC( SQLCOMMIT ) /* bool mysql_commit(MYSQL *mysql) */ { +#if MYSQL_VERSION_ID >= 40100 hb_retnl( ( long ) mysql_commit( ( MYSQL * ) HB_PARPTR( 1 ) ) ); +#else + hb_retnl( ( long ) mysql_query( ( MYSQL * ) HB_PARPTR( 1 ), "COMMIT" ) ); +#endif } HB_FUNC( SQLROLLBACK ) /* bool mysql_rollback(MYSQL *mysql) */ { +#if MYSQL_VERSION_ID >= 40100 hb_retnl( ( long ) mysql_rollback( ( MYSQL * ) HB_PARPTR( 1 ) ) ); +#else + hb_retnl( ( long ) mysql_query( ( MYSQL * ) HB_PARPTR( 1 ), "ROLLBACK" ) ); +#endif } HB_FUNC( SQLSELECTD ) /* int mysql_select_db(MYSQL *, char *) */ diff --git a/harbour/contrib/hbodbc/Makefile b/harbour/contrib/hbodbc/Makefile index c7aa03e2e4..2dbe6bdf7d 100644 --- a/harbour/contrib/hbodbc/Makefile +++ b/harbour/contrib/hbodbc/Makefile @@ -2,11 +2,16 @@ # $Id$ # -ifneq ($(HB_WITHOUT_ODBC),yes) -ifneq ($(HB_COMPILER),rsxnt) - ROOT = ../../ +LIBNAME=hbodbc + +ifeq ($(HB_COMPILER),rsxnt) +HB_WITHOUT_ODBC=yes +endif + +ifneq ($(HB_WITHOUT_ODBC),yes) + C_SOURCES= \ odbc.c \ @@ -17,8 +22,6 @@ PRG_SOURCES= \ PRG_HEADERS=\ sql.ch \ -LIBNAME=hbodbc - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf @@ -26,5 +29,6 @@ include $(TOP)$(ROOT)config/lib.cf install:: $(INSTALL_RULE_HEADERS) -endif +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbole/Makefile b/harbour/contrib/hbole/Makefile index da18be7414..cd4a9d4395 100644 --- a/harbour/contrib/hbole/Makefile +++ b/harbour/contrib/hbole/Makefile @@ -2,18 +2,20 @@ # $Id$ # -ifeq ($(HB_ARCHITECTURE),w32) - ROOT = ../../ +LIBNAME=hbole + +ifeq ($(HB_ARCHITECTURE),w32) + C_SOURCES=\ ole2.c \ PRG_SOURCES=\ oleauto.prg \ -LIBNAME=hbole - include $(TOP)$(ROOT)config/lib.cf +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbpgsql/Makefile b/harbour/contrib/hbpgsql/Makefile index 24d69de2af..e400516e9d 100644 --- a/harbour/contrib/hbpgsql/Makefile +++ b/harbour/contrib/hbpgsql/Makefile @@ -2,6 +2,10 @@ # $Id$ # +ROOT = ../../ + +LIBNAME=hbpgsql + ifeq ($(HB_INC_PGSQL),) HB_INC_PGSQL = /usr/include /usr/local/pgsql/include /usr/local/pgsql/include/libpq /usr/include/pgsql /usr/include/postgresql /postgres/include endif @@ -12,8 +16,6 @@ ifneq ($(strip $(HB_INC_PGSQL_OK)),) C_USR += $(foreach d, $(HB_INC_PGSQL_OK), -I$(d)) -ROOT = ../../ - C_SOURCES=\ postgres.c \ @@ -24,8 +26,6 @@ PRG_SOURCES=\ PRG_HEADERS=\ postgres.ch \ -LIBNAME=hbpgsql - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf @@ -33,4 +33,6 @@ include $(TOP)$(ROOT)config/lib.cf install:: $(INSTALL_RULE_HEADERS) +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbtip/Makefile b/harbour/contrib/hbtip/Makefile index 834cc1b304..98145e5a6a 100644 --- a/harbour/contrib/hbtip/Makefile +++ b/harbour/contrib/hbtip/Makefile @@ -2,10 +2,12 @@ # $Id$ # -ifneq ($(HB_ARCHITECTURE),dos) - ROOT = ../../ +LIBNAME=hbtip + +ifneq ($(HB_ARCHITECTURE),dos) + C_SOURCES = \ base64x.c \ encmthd.c \ @@ -33,8 +35,6 @@ PRG_HEADERS= \ thtml.ch \ tip.ch \ -LIBNAME=hbtip - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf @@ -42,4 +42,6 @@ include $(TOP)$(ROOT)config/lib.cf install:: $(INSTALL_RULE_HEADERS) +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbtpathy/Makefile b/harbour/contrib/hbtpathy/Makefile index 4f56c725db..d5d6730a65 100644 --- a/harbour/contrib/hbtpathy/Makefile +++ b/harbour/contrib/hbtpathy/Makefile @@ -4,7 +4,9 @@ ROOT = ../../ -ifneq ($(HB_ARCHITECTURE),dos) +LIBNAME=hbtpathy + +C_SOURCES= ifeq ($(HB_ARCHITECTURE),linux) C_SOURCES=\ @@ -25,14 +27,14 @@ C_SOURCES=\ endif +ifneq ($(C_SOURCES),) + PRG_SOURCES=\ telepath.prg \ PRG_HEADERS=\ telepath.ch \ -LIBNAME=hbtpathy - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf @@ -40,4 +42,6 @@ include $(TOP)$(ROOT)config/lib.cf install:: $(INSTALL_RULE_HEADERS) +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbw32/Makefile b/harbour/contrib/hbw32/Makefile index 0341556a12..384710d545 100644 --- a/harbour/contrib/hbw32/Makefile +++ b/harbour/contrib/hbw32/Makefile @@ -2,11 +2,12 @@ # $Id$ # -ifeq ($(HB_ARCHITECTURE),w32) -ifneq ($(HB_COMPILER),rsxnt) - ROOT = ../../ +LIBNAME=hbw32 + +ifeq ($(HB_ARCHITECTURE),w32) + C_SOURCES=\ dllcall.c \ tprinter.c \ @@ -22,8 +23,6 @@ PRG_SOURCES=\ PRG_HEADERS = \ hbw32.ch \ -LIBNAME=hbw32 - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf @@ -31,5 +30,6 @@ include $(TOP)$(ROOT)config/lib.cf install:: $(INSTALL_RULE_HEADERS) -endif +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbw32ddr/Makefile b/harbour/contrib/hbw32ddr/Makefile index 00dd1d6203..9d1a002257 100644 --- a/harbour/contrib/hbw32ddr/Makefile +++ b/harbour/contrib/hbw32ddr/Makefile @@ -5,19 +5,21 @@ # Needs Windows official ddraw.h to be copied to this directory, # in order to compile under MingW. [vszakats] -ifeq ($(HB_ARCHITECTURE),w32) - ROOT = ../../ +LIBNAME=hbw32ddr + +ifeq ($(HB_ARCHITECTURE),w32) + CPP_SOURCES=\ w32_ddrw.cpp \ PRG_SOURCES=\ -LIBNAME=hbw32ddr - include $(TOP)$(ROOT)config/lib.cf C_USR += -I. +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbwhat32/Makefile b/harbour/contrib/hbwhat32/Makefile index 0588c89918..0be6b01d70 100644 --- a/harbour/contrib/hbwhat32/Makefile +++ b/harbour/contrib/hbwhat32/Makefile @@ -2,10 +2,12 @@ # $Id$ # -ifeq ($(HB_ARCHITECTURE),w32) - ROOT = ../../ +LIBNAME=hbwhat32 + +ifeq ($(HB_ARCHITECTURE),w32) + C_SOURCES = \ wincorec.c \ _winbmp.c \ @@ -81,8 +83,6 @@ PRG_HEADERS= \ wintypes.ch \ winuser.ch \ -LIBNAME=hbwhat32 - # This lib needs xhb headers to compile, and this is # the hack to help Harbour find them. PRG_USR += -I../../../xhb @@ -94,4 +94,6 @@ include $(TOP)$(ROOT)config/lib.cf install:: $(INSTALL_RULE_HEADERS) +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/hbziparch/Makefile b/harbour/contrib/hbziparch/Makefile index f1b3451ca9..a97bcc5f09 100644 --- a/harbour/contrib/hbziparch/Makefile +++ b/harbour/contrib/hbziparch/Makefile @@ -2,11 +2,21 @@ # $Id$ # -ifneq ($(HB_ARCHITECTURE),darwin) -ifneq ($(HB_ARCHITECTURE),os2) - ROOT = ../../ +LIBNAME=hbziparch + +ifeq ($(HB_WITH_ZIPARCH),) +ifeq ($(HB_ARCHITECTURE),w32) + HB_WITH_ZIPARCH=yes +endif +ifeq ($(HB_ARCHITECTURE),linux) + HB_WITH_ZIPARCH=yes +endif +endif + +ifeq ($(HB_WITH_ZIPARCH),yes) + PRG_HEADERS = \ C_SOURCES = \ @@ -60,13 +70,12 @@ endif PRG_SOURCES= \ -LIBNAME=hbziparch - ifeq ($(HB_ARCHITECTURE),linux) C_USR += -DZIP_ARCHIVE_LNX endif include $(TOP)$(ROOT)config/lib.cf -endif +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/rddado/Makefile b/harbour/contrib/rddado/Makefile index 46258edd57..5dee669669 100644 --- a/harbour/contrib/rddado/Makefile +++ b/harbour/contrib/rddado/Makefile @@ -2,9 +2,6 @@ # $Id$ # -# Needs hbw32 and hbodbc, but these won't build with rsxnt -ifneq ($(HB_COMPILER),rsxnt) - ROOT = ../../ PRG_SOURCES= \ @@ -21,5 +18,3 @@ include $(TOP)$(ROOT)config/lib.cf install:: $(INSTALL_RULE_HEADERS) - -endif diff --git a/harbour/contrib/rddads/Makefile b/harbour/contrib/rddads/Makefile index b0052ca086..e2f2603326 100644 --- a/harbour/contrib/rddads/Makefile +++ b/harbour/contrib/rddads/Makefile @@ -2,6 +2,10 @@ # $Id$ # +ROOT = ../../ + +LIBNAME=rddads + ifeq ($(HB_INC_ADS),) HB_INC_ADS = /usr/local/ads/acesdk $(HOME)/ads/acesdk endif @@ -12,8 +16,6 @@ ifneq ($(strip $(HB_INC_ADS_OK)),) C_USR += $(foreach d, $(HB_INC_ADS_OK), -I$(d)) -ROOT = ../../ - C_SOURCES=\ ads1.c \ adsfunc.c \ @@ -22,8 +24,6 @@ C_SOURCES=\ PRG_HEADERS=\ ads.ch \ -LIBNAME=rddads - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf @@ -31,4 +31,6 @@ include $(TOP)$(ROOT)config/lib.cf install:: $(INSTALL_RULE_HEADERS) +else +include $(TOP)$(ROOT)config/none.cf endif diff --git a/harbour/contrib/xhb/Makefile b/harbour/contrib/xhb/Makefile index 07ec971ac5..163f3978ee 100644 --- a/harbour/contrib/xhb/Makefile +++ b/harbour/contrib/xhb/Makefile @@ -17,7 +17,6 @@ C_SOURCES=\ xhbqself.c \ xhbwith.c \ hbcomprs.c \ - hbchksum.c \ xstrdel.c \ C_HEADERS=\ diff --git a/harbour/contrib/xhb/common.mak b/harbour/contrib/xhb/common.mak index ac36617844..32b705aea9 100644 --- a/harbour/contrib/xhb/common.mak +++ b/harbour/contrib/xhb/common.mak @@ -26,7 +26,6 @@ LIB_OBJS = \ $(OBJ_DIR)xhbqself$(OBJEXT) \ $(OBJ_DIR)xhbwith$(OBJEXT) \ $(OBJ_DIR)hbcomprs$(OBJEXT) \ - $(OBJ_DIR)hbchksum$(OBJEXT) \ $(OBJ_DIR)xstrdel$(OBJEXT) \ \ $(OBJ_DIR)txml$(OBJEXT) \ diff --git a/harbour/contrib/xhb/hbchksum.c b/harbour/contrib/xhb/hbchksum.c deleted file mode 100644 index aa244803b3..0000000000 --- a/harbour/contrib/xhb/hbchksum.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * $Id$ - */ - -/* - * xHarbour Project source code: - * Fast and reliable checksum function - * - * Copyright 2003 Giancarlo Niccolai - * www - http://www.xharbour.org - * SEE ALSO COPYRIGHT NOTICE FOR ADLER32 BELOW. - * - * 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. - * - */ - -/* This file includes code slices from adler32.c for advanced CRC - * Holder of copyright for this code is: - * - * Copyright (C) 1995-2002 Mark Adler - * - * ZLIB (containing adler32 code) can be found at: - * http://www.gzip.org/zlib/ - */ - -#include "hbapi.h" -#include "hbapiitm.h" -#include "hbstack.h" -#include "hbvm.h" -#include "hbapierr.h" - -/* ========================================================================= */ - -#define BASE 65521L /* largest prime smaller than 65536 */ -#define NMAX 5552 -/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ - -#define DO1(buf,i) {s1 += buf[i]; s2 += s1;} -#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); -#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); -#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); -#define DO16(buf) DO8(buf,0); DO8(buf,8); - -ULONG HB_EXPORT adler32( ULONG adler, const BYTE *buf, UINT len) -{ - ULONG s1 = adler & 0xffff; - ULONG s2 = (adler >> 16) & 0xffff; - int k; - - if (buf == NULL) return 1L; - - while (len > 0) { - k = len < NMAX ? len : NMAX; - len -= k; - while (k >= 16) { - DO16(buf); - buf += 16; - k -= 16; - } - if (k != 0) do { - s1 += *buf++; - s2 += s1; - } while (--k); - s1 %= BASE; - s2 %= BASE; - } - return (s2 << 16) | s1; -} - - -HB_FUNC( HB_CHECKSUM ) -{ - PHB_ITEM pString = hb_param( 1, HB_IT_STRING ); - ULONG ulSum = 0; - - if(pString == NULL) - { - hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, "Must be a string", 1, hb_param(1, HB_IT_ANY) ); - return; - } - - if( ISNUM(2) ) - { - ulSum = (ULONG) hb_parnl( 2 ); - } - /* - hb_retnd( (LONG) - adler32( ulSum, ( const BYTE *) pString->item.asString.value, pString->item.asString.length ) ); - */ - hb_retnd( (LONG) - adler32( ulSum, ( const BYTE *) hb_itemGetCPtr( pString ), hb_itemGetCLen( pString ) ) ); - -} - diff --git a/harbour/contrib/xhb/xhbfunc.c b/harbour/contrib/xhb/xhbfunc.c index fc7bfdedc7..fdb9a810bd 100644 --- a/harbour/contrib/xhb/xhbfunc.c +++ b/harbour/contrib/xhb/xhbfunc.c @@ -115,6 +115,13 @@ HB_FUNC( WILDMATCH ) HB_FUNC_EXEC( HB_WILDMATCH ); } +HB_FUNC_EXTERN( HB_ADLER32 ); + +HB_FUNC( HB_CHECKSUM ) +{ + HB_FUNC_EXEC( HB_ADLER32 ); +} + /* Hash utem functions */ HB_FUNC_EXTERN( HB_HASH ); HB_FUNC_EXTERN( HB_HHASKEY ); diff --git a/harbour/make_deb.sh b/harbour/make_deb.sh index e35afdd13a..a98b120f0b 100755 --- a/harbour/make_deb.sh +++ b/harbour/make_deb.sh @@ -46,16 +46,18 @@ then export HB_WITHOUT_X11=yes fi -if [ -z "$HB_WITHOUT_ODBC" ] && ! test_reqpkg unixodbc-dev -then - export HB_WITHOUT_ODBC=yes -fi +export HB_CONTRIBLIBS="hbct hbmzip hbtip xhb hbbtree hbmisc hbvpdf hbgt hbbmcdx hbclipsm hbnf" if [ -z "$HB_WITHOUT_ADS" ] && \ [ ! -f "/usr/local/ads/acesdk/ace.h" ] && \ [ ! -f "${HOME}/ads/acesdk/ace.h" ] then - export HB_WITHOUT_ADS=yes + export HB_CONTRIBLIBS="${HB_CONTRIBLIBS} rddads" +fi + +if [ -z "$HB_WITHOUT_ODBC" ] && ! test_reqpkg unixodbc-dev +then + export HB_CONTRIBLIBS="${HB_CONTRIBLIBS} hbodbc" fi if test_reqpkg libpq-dev diff --git a/harbour/source/rtl/gtwvt/gtwvt.c b/harbour/source/rtl/gtwvt/gtwvt.c index 0b131e1c30..cb6bd25278 100644 --- a/harbour/source/rtl/gtwvt/gtwvt.c +++ b/harbour/source/rtl/gtwvt/gtwvt.c @@ -1,4 +1,4 @@ - /* +/* * $Id$ */ @@ -900,6 +900,7 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L rect.right != s_rectOld.right || rect.bottom != s_rectOld.bottom ) { +#if !defined(HB_WINCE) /* WinCE does not support InvertRgn */ /* Concept forwarded by Andy Wos - thanks. */ HRGN rgn1 = CreateRectRgn( s_rectOld.left, s_rectOld.top, s_rectOld.right, s_rectOld.bottom ); HRGN rgn2 = CreateRectRgn( rect.left, rect.top, rect.right, rect.bottom ); @@ -915,7 +916,7 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L DeleteObject( rgn1 ); DeleteObject( rgn2 ); DeleteObject( rgn3 ); - +#endif s_rectOld.left = rect.left; s_rectOld.top = rect.top; s_rectOld.right = rect.right; @@ -1628,9 +1629,12 @@ static void hb_gt_wvt_Init( PHB_GT pGT, FHANDLE hFilenoStdin, FHANDLE hFilenoStd /* Create "Mark" prompt in SysMenu to allow console type copy operation */ { HMENU hSysMenu = GetSystemMenu( pWVT->hWnd, FALSE ); - LPTSTR buffer = HB_TCHAR_CONVTO( pWVT->pszSelectCopy ); - AppendMenu( hSysMenu, MF_STRING, SYS_EV_MARK, buffer ); - HB_TCHAR_FREE( buffer ); + if( hSysMenu ) + { + LPTSTR buffer = HB_TCHAR_CONVTO( pWVT->pszSelectCopy ); + AppendMenu( hSysMenu, MF_STRING, SYS_EV_MARK, buffer ); + HB_TCHAR_FREE( buffer ); + } } /* SUPER GT initialization */ @@ -2185,17 +2189,22 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) if( hb_itemGetCLen( pInfo->pNewVal ) ) { HMENU hSysMenu = GetSystemMenu( pWVT->hWnd, FALSE ); - LPTSTR buffer; - - if( pWVT->pszSelectCopy ) - hb_xfree( pWVT->pszSelectCopy ); - - pWVT->pszSelectCopy = hb_strdup( hb_itemGetCPtr( pInfo->pNewVal ) ); - pWVT->bSelectCopy = TRUE; - - buffer = HB_TCHAR_CONVTO( pWVT->pszSelectCopy ); - ModifyMenu( hSysMenu, SYS_EV_MARK, MF_BYCOMMAND | MF_STRING | MF_ENABLED, SYS_EV_MARK, buffer ); - HB_TCHAR_FREE( buffer ); + if( hSysMenu ) + { + if( pWVT->pszSelectCopy ) + hb_xfree( pWVT->pszSelectCopy ); + pWVT->pszSelectCopy = hb_strdup( hb_itemGetCPtr( pInfo->pNewVal ) ); + pWVT->bSelectCopy = TRUE; + +#if !defined(HB_WINCE) /* WinCE does not support ModifyMenu */ + { + LPTSTR buffer; + buffer = HB_TCHAR_CONVTO( pWVT->pszSelectCopy ); + ModifyMenu( hSysMenu, SYS_EV_MARK, MF_BYCOMMAND | MF_STRING | MF_ENABLED, SYS_EV_MARK, buffer ); + HB_TCHAR_FREE( buffer ); + } +#endif + } } } else if( pInfo->pNewVal ) @@ -2204,9 +2213,11 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) if( bNewValue != pWVT->bSelectCopy ) { HMENU hSysMenu = GetSystemMenu( pWVT->hWnd, FALSE ); - - EnableMenuItem( hSysMenu, SYS_EV_MARK, MF_BYCOMMAND | ( bNewValue ? MF_ENABLED : MF_GRAYED ) ); - pWVT->bSelectCopy = bNewValue; + if( hSysMenu ) + { + EnableMenuItem( hSysMenu, SYS_EV_MARK, MF_BYCOMMAND | ( bNewValue ? MF_ENABLED : MF_GRAYED ) ); + pWVT->bSelectCopy = bNewValue; + } } } break; @@ -2220,9 +2231,11 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) if( bNewValue != pWVT->bClosable ) { HMENU hSysMenu = GetSystemMenu( pWVT->hWnd, FALSE ); - - EnableMenuItem( hSysMenu, SC_CLOSE, MF_BYCOMMAND | ( bNewValue ? MF_ENABLED : MF_GRAYED ) ); - pWVT->bClosable = bNewValue; + if( hSysMenu ) + { + EnableMenuItem( hSysMenu, SC_CLOSE, MF_BYCOMMAND | ( bNewValue ? MF_ENABLED : MF_GRAYED ) ); + pWVT->bClosable = bNewValue; + } } } break;