2010-03-05 20:58 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/common/hbverdsp.c
% "Language options" merged into "Build options"
* src/rtl/gtwin/gtwin.c
- Deleted not working undocumented SetConsolePalette() code sections.
* HB_GTI_PALETTE will return zeroes (black) on platforms/builds which
don't support console palette API.
+ Enabled SetConsoleMenuClose() undocumented call in default builds.
It seems so simple function that it's unlikely it will change
(worst case it will be deleted). Return value confirmed to be
BOOL (don't ask how).
This feature requires Windows 2000 for final apps, no build-time
requirement.
Can be disabled using HB_GTWIN_USE_SETCONSOLEMENUCLOSE_OFF macro.
% Minor optimization.
* contrib/hbwin/win_reg.prg
! Changed to use local emulation of BIN2U() instead of XPP
specific original implementation.
This commit is contained in:
@@ -17,6 +17,27 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2010-03-05 20:58 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* src/common/hbverdsp.c
|
||||
% "Language options" merged into "Build options"
|
||||
|
||||
* src/rtl/gtwin/gtwin.c
|
||||
- Deleted not working undocumented SetConsolePalette() code sections.
|
||||
* HB_GTI_PALETTE will return zeroes (black) on platforms/builds which
|
||||
don't support console palette API.
|
||||
+ Enabled SetConsoleMenuClose() undocumented call in default builds.
|
||||
It seems so simple function that it's unlikely it will change
|
||||
(worst case it will be deleted). Return value confirmed to be
|
||||
BOOL (don't ask how).
|
||||
This feature requires Windows 2000 for final apps, no build-time
|
||||
requirement.
|
||||
Can be disabled using HB_GTWIN_USE_SETCONSOLEMENUCLOSE_OFF macro.
|
||||
% Minor optimization.
|
||||
|
||||
* contrib/hbwin/win_reg.prg
|
||||
! Changed to use local emulation of BIN2U() instead of XPP
|
||||
specific original implementation.
|
||||
|
||||
2010-03-05 19:26 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* src/rtl/gtwin/gtwin.c
|
||||
+ Added more code (probably the ugliest I've ever had a chance
|
||||
|
||||
@@ -158,6 +158,10 @@ FUNCTION win_regQuery( nHKEY, cKeyName, cEntryName, xValue, lSetIt )
|
||||
|
||||
RETURN lRetVal
|
||||
|
||||
STATIC FUNCTION Bin2U( c )
|
||||
LOCAL l := Bin2L( c )
|
||||
RETURN iif( l < 0, l + 4294967296, l )
|
||||
|
||||
FUNCTION win_regGet( nHKEY, cKeyName, cEntryName, xDefault )
|
||||
LOCAL xRetVal
|
||||
LOCAL pKeyHandle
|
||||
|
||||
@@ -151,9 +151,6 @@ void hb_verBuildInfo( void )
|
||||
#if defined( __cplusplus )
|
||||
hb_conOutErr( "(C++ mode) ", 0 );
|
||||
#endif
|
||||
hb_conOutErr( hb_conNewLine(), 0 );
|
||||
|
||||
hb_conOutErr( "Language options: ", 0 );
|
||||
#if defined( HB_COMPAT_C53 )
|
||||
hb_conOutErr( "(Clipper 5.3b) ", 0 );
|
||||
#endif
|
||||
|
||||
@@ -88,6 +88,10 @@
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0600 /* for hb_gt_win_SetPalette_Vista() */
|
||||
|
||||
#ifndef HB_GTWIN_USE_SETCONSOLEMENUCLOSE_OFF
|
||||
# define HB_GTWIN_USE_SETCONSOLEMENUCLOSE /* Enable undocumented Windows API function call */
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#if defined( HB_OS_WIN_CE )
|
||||
# include "hbwince.h"
|
||||
@@ -736,70 +740,17 @@ static void hb_gt_win_SetPalette_Vista( HB_BOOL bSet, COLORREF * colors )
|
||||
|
||||
#endif
|
||||
|
||||
#if defined( HB_GTWIN_USE_UNDOC_WINAPI )
|
||||
|
||||
static void hb_gt_win_SetPalette_Undoc( HB_BOOL bSet, COLORREF * colors )
|
||||
{
|
||||
static HB_BOOL s_bChecked = HB_FALSE;
|
||||
|
||||
typedef BOOL ( WINAPI * P_SETCONSOLEPALETTE )( HANDLE, HPALETTE, UINT );
|
||||
static P_SETCONSOLEPALETTE s_pSetConsolePalette;
|
||||
|
||||
if( ! s_bChecked )
|
||||
{
|
||||
s_pSetConsolePalette = ( P_SETCONSOLEPALETTE ) GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ), "SetConsolePalette" );
|
||||
s_bChecked = HB_TRUE;
|
||||
}
|
||||
|
||||
if( bSet && s_pSetConsolePalette )
|
||||
{
|
||||
#define _NUM_ENTRIES 16
|
||||
|
||||
LOGPALETTE * lp = hb_xgrab( sizeof( LOGPALETTE ) + sizeof( PALETTEENTRY ) * _NUM_ENTRIES );
|
||||
HPALETTE palette;
|
||||
int tmp;
|
||||
|
||||
lp->palVersion = ( WORD ) 0x0300;
|
||||
lp->palNumEntries = _NUM_ENTRIES;
|
||||
|
||||
for( tmp = 0; tmp < 16; ++tmp )
|
||||
{
|
||||
lp->palPalEntry[ tmp ].peRed = GetRValue( colors[ tmp ] );
|
||||
lp->palPalEntry[ tmp ].peGreen = GetGValue( colors[ tmp ] );
|
||||
lp->palPalEntry[ tmp ].peBlue = GetBValue( colors[ tmp ] );
|
||||
lp->palPalEntry[ tmp ].peFlags = 0;
|
||||
}
|
||||
|
||||
palette = CreatePalette( lp );
|
||||
|
||||
#ifndef SYSPAL_STATIC
|
||||
#define SYSPAL_STATIC 1
|
||||
#endif
|
||||
|
||||
s_pSetConsolePalette( s_HOutput, palette, SYSPAL_STATIC );
|
||||
|
||||
DeleteObject( palette );
|
||||
|
||||
hb_xfree( lp );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void hb_gt_win_SetPalette( HB_BOOL bSet, COLORREF * colors )
|
||||
{
|
||||
#if defined( NTDDI_VERSION ) && NTDDI_VERSION >= NTDDI_VISTA
|
||||
if( hb_iswinvista() )
|
||||
hb_gt_win_SetPalette_Vista( bSet, colors );
|
||||
#if defined( HB_GTWIN_USE_UNDOC_WINAPI )
|
||||
else
|
||||
hb_gt_win_SetPalette_Undoc( bSet, colors );
|
||||
#endif
|
||||
#elif defined( HB_GTWIN_USE_UNDOC_WINAPI )
|
||||
hb_gt_win_SetPalette_Undoc( bSet, colors );
|
||||
hb_gt_win_SetPalette_Vista( bSet, colors );
|
||||
#else
|
||||
HB_SYMBOL_UNUSED( bSet );
|
||||
HB_SYMBOL_UNUSED( colors );
|
||||
if( ! bSet )
|
||||
{
|
||||
int tmp;
|
||||
for( tmp = 0; tmp < 16; ++tmp )
|
||||
colors[ tmp ] = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -810,7 +761,7 @@ static HB_BOOL hb_gt_win_SetCloseButton( HB_BOOL bSet, HB_BOOL bClosable )
|
||||
typedef HWND ( WINAPI * P_GETCONSOLEWINDOW )( void );
|
||||
static P_GETCONSOLEWINDOW s_pGetConsoleWindow;
|
||||
|
||||
#if defined( HB_GTWIN_USE_UNDOC_WINAPI )
|
||||
#if defined( HB_GTWIN_USE_SETCONSOLEMENUCLOSE )
|
||||
typedef BOOL ( WINAPI * P_SETCONSOLEMENUCLOSE )( BOOL );
|
||||
static P_SETCONSOLEMENUCLOSE s_pSetConsoleMenuClose;
|
||||
#endif
|
||||
@@ -819,9 +770,10 @@ static HB_BOOL hb_gt_win_SetCloseButton( HB_BOOL bSet, HB_BOOL bClosable )
|
||||
|
||||
if( ! s_bChecked )
|
||||
{
|
||||
s_pGetConsoleWindow = ( P_GETCONSOLEWINDOW ) GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ), "GetConsoleWindow" );
|
||||
#if defined( HB_GTWIN_USE_UNDOC_WINAPI )
|
||||
s_pSetConsoleMenuClose = ( P_SETCONSOLEMENUCLOSE ) GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ), "SetConsoleMenuClose" );
|
||||
HMODULE hKernel32 = GetModuleHandle( TEXT( "kernel32.dll" ) );
|
||||
s_pGetConsoleWindow = ( P_GETCONSOLEWINDOW ) GetProcAddress( hKernel32, "GetConsoleWindow" );
|
||||
#if defined( HB_GTWIN_USE_SETCONSOLEMENUCLOSE )
|
||||
s_pSetConsoleMenuClose = ( P_SETCONSOLEMENUCLOSE ) GetProcAddress( hKernel32, "SetConsoleMenuClose" );
|
||||
#endif
|
||||
s_bChecked = HB_TRUE;
|
||||
}
|
||||
@@ -836,7 +788,7 @@ static HB_BOOL hb_gt_win_SetCloseButton( HB_BOOL bSet, HB_BOOL bClosable )
|
||||
|
||||
if( bSet )
|
||||
{
|
||||
#if defined( HB_GTWIN_USE_UNDOC_WINAPI )
|
||||
#if defined( HB_GTWIN_USE_SETCONSOLEMENUCLOSE )
|
||||
if( s_pSetConsoleMenuClose )
|
||||
s_pSetConsoleMenuClose( bClosable );
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user