diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 78c477b03d..904d80d1b2 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,20 @@ The license applies to all entries newer than 2009-04-28. */ +2011-02-14 14:39 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbwin/hbwin.hbx + * contrib/hbwin/win_regc.c + * contrib/hbwin/win_reg.prg + * contrib/hbwin/tests/testreg.prg + + Added WIN_REGDELETE() high-level function. + + Added WIN_REGDELETEKEY() Windows API (non-1-to-1) wrapper. + + Added WIN_REGDELETEVALUE() Windows API (non-1-to-1) wrapper. + + * contrib/hbqt/hbmk2_qt.hbs + * contrib/hbqt/qtgui/hbqtgui.h + * contrib/hbqt/qtcore/hbqtcore.h + + Cast HBQT_TYPE_ constants to unsigned int. + 2011-02-14 12:58 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbide/idemain.prg * contrib/hbide/hbide.hbp diff --git a/harbour/contrib/hbqt/hbmk2_qt.hbs b/harbour/contrib/hbqt/hbmk2_qt.hbs index 304d42a14e..61182c517a 100644 --- a/harbour/contrib/hbqt/hbmk2_qt.hbs +++ b/harbour/contrib/hbqt/hbmk2_qt.hbs @@ -1361,7 +1361,7 @@ METHOD HbQtSource:build() NEXT aadd( aLine, "" ) FOR EACH s IN ::hRef - aadd( aLine, PadR( "#define HBQT_TYPE_" + s:__enumKey(), 64 ) + "0x" + hb_NumToHex( hb_crc32( "HBQT_TYPE_" + hb_asciiUpper( ::cQtModule ) + s:__enumKey() ), 8 ) ) + aadd( aLine, PadR( "#define HBQT_TYPE_" + s:__enumKey(), 64 ) + "( ( unsigned int ) 0x" + hb_NumToHex( hb_crc32( "HBQT_TYPE_" + hb_asciiUpper( ::cQtModule ) + s:__enumKey() ), 8 ) + " )" ) NEXT aadd( aLine, "" ) /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtcore/hbqtcore.h b/harbour/contrib/hbqt/qtcore/hbqtcore.h index 46d5b60814..9008e209fe 100644 --- a/harbour/contrib/hbqt/qtcore/hbqtcore.h +++ b/harbour/contrib/hbqt/qtcore/hbqtcore.h @@ -23,6 +23,6 @@ HB_EXTERN_END #define hbqt_par_HBQSlots( n ) ( ( HBQSlots * ) hbqt_gcpointer( n ) ) #define hbqt_par_HBQString( n ) ( ( HBQString * ) hbqt_gcpointer( n ) ) -#define HBQT_TYPE_QSize 0x5E28750F +#define HBQT_TYPE_QSize ( ( unsigned int ) 0x5E28750F ) #endif /* __HBQTCORE_H */ diff --git a/harbour/contrib/hbqt/qtgui/hbqtgui.h b/harbour/contrib/hbqt/qtgui/hbqtgui.h index 407da62725..592f5cdab1 100644 --- a/harbour/contrib/hbqt/qtgui/hbqtgui.h +++ b/harbour/contrib/hbqt/qtgui/hbqtgui.h @@ -29,16 +29,16 @@ HB_EXTERN_END #define hbqt_par_QPrinter( n ) ( ( QPrinter * ) hbqt_gcpointer( n ) ) #define hbqt_par_QWidget( n ) ( ( QWidget * ) hbqt_gcpointer( n ) ) -#define HBQT_TYPE_QBitmap 0x210679C1 -#define HBQT_TYPE_QBoxLayout 0x8E2E0CAF -#define HBQT_TYPE_QBrush 0x96A039B0 -#define HBQT_TYPE_QColor 0x0151A39A -#define HBQT_TYPE_QFont 0x0A35B749 +#define HBQT_TYPE_QBitmap ( ( unsigned int ) 0x210679C1 ) +#define HBQT_TYPE_QBoxLayout ( ( unsigned int ) 0x8E2E0CAF ) +#define HBQT_TYPE_QBrush ( ( unsigned int ) 0x96A039B0 ) +#define HBQT_TYPE_QColor ( ( unsigned int ) 0x0151A39A ) +#define HBQT_TYPE_QFont ( ( unsigned int ) 0x0A35B749 ) #ifndef HBQT_TYPE_QIcon -#define HBQT_TYPE_QIcon 0xBF359640 +#define HBQT_TYPE_QIcon ( ( unsigned int ) 0xBF359640 ) #endif #ifndef HBQT_TYPE_QPixmap -#define HBQT_TYPE_QPixmap 0x25CE65E9 +#define HBQT_TYPE_QPixmap ( ( unsigned int ) 0x25CE65E9 ) #endif #endif /* __HBQTGUI_H */ diff --git a/harbour/contrib/hbwin/hbwin.hbx b/harbour/contrib/hbwin/hbwin.hbx index bda86640cc..71ca4efe3a 100644 --- a/harbour/contrib/hbwin/hbwin.hbx +++ b/harbour/contrib/hbwin/hbwin.hbx @@ -380,6 +380,9 @@ DYNAMIC WIN_PRN DYNAMIC WIN_RECTANGLE DYNAMIC WIN_REGCLOSEKEY DYNAMIC WIN_REGCREATEKEYEX +DYNAMIC WIN_REGDELETE +DYNAMIC WIN_REGDELETEKEY +DYNAMIC WIN_REGDELETEVALUE DYNAMIC WIN_REGGET DYNAMIC WIN_REGOPENKEYEX DYNAMIC WIN_REGPATHSPLIT diff --git a/harbour/contrib/hbwin/tests/testreg.prg b/harbour/contrib/hbwin/tests/testreg.prg index af9c65de21..aa7e2f9548 100644 --- a/harbour/contrib/hbwin/tests/testreg.prg +++ b/harbour/contrib/hbwin/tests/testreg.prg @@ -7,6 +7,9 @@ PROCEDURE Main() LOCAL tmp + ? win_regDelete( "HKCU\_TEST\teszt" ) + ? win_regDelete( "HKCU\_TEST\" ) + ? ">" + win_GetCommandLineParam() + "<" ? ">" + wapi_GetCommandLine() + "<" diff --git a/harbour/contrib/hbwin/win_reg.prg b/harbour/contrib/hbwin/win_reg.prg index 704091591e..ae22e7afb6 100644 --- a/harbour/contrib/hbwin/win_reg.prg +++ b/harbour/contrib/hbwin/win_reg.prg @@ -56,6 +56,29 @@ /* ------------------------------------------------------------------- */ +/* Predefined Value Types. from winnt.h */ +#define KEY_QUERY_VALUE 1 +#define KEY_SET_VALUE 2 +#define KEY_CREATE_SUB_KEY 4 +#define KEY_ENUMERATE_SUB_KEYS 8 +#define KEY_NOTIFY 16 +#define KEY_CREATE_LINK 32 + +#define REG_NONE 0 // No value type +#define REG_SZ 1 // Unicode nul terminated string +#define REG_EXPAND_SZ 2 // Unicode nul terminated string (with environment variable references) +#define REG_BINARY 3 // Free form binary +#define REG_DWORD 4 // 32-bit number +#define REG_DWORD_LITTLE_ENDIAN 4 // 32-bit number (same as REG_DWORD) +#define REG_DWORD_BIG_ENDIAN 5 // 32-bit number +#define REG_LINK 6 // Symbolic Link (unicode) +#define REG_MULTI_SZ 7 // Multiple Unicode strings +#define REG_RESOURCE_LIST 8 // Resource list in the resource map +#define REG_FULL_RESOURCE_DESCRIPTOR 9 // Resource list in the hardware description +#define REG_RESOURCE_REQUIREMENTS_LIST 10 + +/* ------------------------------------------------------------------- */ + PROCEDURE win_regPathSplit( cRegPath, /* @ */ nHKEY, /* @ */ cKey, /* @ */ cEntry ) LOCAL cHKEY LOCAL tmp @@ -112,28 +135,25 @@ FUNCTION win_regWrite( cRegPath, xValue ) RETURN win_regSet( nHKEY, cKey, cEntry, xValue ) -/* ------------------------------------------------------------------- */ +FUNCTION win_regDelete( cRegPath ) + LOCAL nHKEY, cKey, cEntry + LOCAL lRetVal + LOCAL pKeyHandle -/* Predefined Value Types. from winnt.h */ -#define KEY_QUERY_VALUE 1 -#define KEY_SET_VALUE 2 -#define KEY_CREATE_SUB_KEY 4 -#define KEY_ENUMERATE_SUB_KEYS 8 -#define KEY_NOTIFY 16 -#define KEY_CREATE_LINK 32 + win_regPathSplit( cRegPath, @nHKEY, @cKey, @cEntry ) -#define REG_NONE 0 // No value type -#define REG_SZ 1 // Unicode nul terminated string -#define REG_EXPAND_SZ 2 // Unicode nul terminated string (with environment variable references) -#define REG_BINARY 3 // Free form binary -#define REG_DWORD 4 // 32-bit number -#define REG_DWORD_LITTLE_ENDIAN 4 // 32-bit number (same as REG_DWORD) -#define REG_DWORD_BIG_ENDIAN 5 // 32-bit number -#define REG_LINK 6 // Symbolic Link (unicode) -#define REG_MULTI_SZ 7 // Multiple Unicode strings -#define REG_RESOURCE_LIST 8 // Resource list in the resource map -#define REG_FULL_RESOURCE_DESCRIPTOR 9 // Resource list in the hardware description -#define REG_RESOURCE_REQUIREMENTS_LIST 10 + IF Empty( cEntry ) + lRetVal := win_regDeleteKey( nHKEY, cKey ) + ELSE + IF win_regOpenKeyEx( nHKEY, cKey, 0, KEY_SET_VALUE, @pKeyHandle ) + lRetVal := win_regDeleteValue( pKeyHandle, cEntry ) + win_regCloseKey( pKeyHandle ) + ELSE + lRetVal := .F. + ENDIF + ENDIF + + RETURN lRetVal FUNCTION win_regQuery( nHKEY, cKeyName, cEntryName, xValue, lSetIt ) LOCAL xKey := win_regGet( nHKEY, cKeyName, cEntryName ) diff --git a/harbour/contrib/hbwin/win_regc.c b/harbour/contrib/hbwin/win_regc.c index 8116bf14e7..f25a95e457 100644 --- a/harbour/contrib/hbwin/win_regc.c +++ b/harbour/contrib/hbwin/win_regc.c @@ -237,6 +237,26 @@ HB_FUNC( WIN_REGSETVALUEEX ) hb_strfree( hKey ); } +HB_FUNC( WIN_REGDELETEKEY ) +{ + void * hKey; + + hb_retl( RegDeleteKey( hb_regkeyconv( ( HB_PTRUINT ) hb_parnint( 1 ) ), + ( LPCTSTR ) HB_PARSTRDEF( 2, &hKey, NULL ) ) == ERROR_SUCCESS ); + + hb_strfree( hKey ); +} + +HB_FUNC( WIN_REGDELETEVALUE ) +{ + void * hValue; + + hb_retl( RegDeleteValue( ( HKEY ) hb_parptr( 1 ), + ( LPCTSTR ) HB_PARSTR( 2, &hValue, NULL ) ) == ERROR_SUCCESS ); + + hb_strfree( hValue ); +} + HB_FUNC( WIN_REGCLOSEKEY ) { hb_retl( RegCloseKey( ( HKEY ) hb_parptr( 1 ) ) == ERROR_SUCCESS );