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
      to create while touching Windows API) for undocumented
      SetConsolePalette() hack, following Saulius Zrelskis's
      suggestion. Now it doesn't GPF, but it does nothing else
      either (could be wrong SYSPAL_ constant, could be anything).
      From this point I'll let others continue, or delete all
      undocumented code sections.
This commit is contained in:
Viktor Szakats
2010-03-05 18:29:41 +00:00
parent 1a9fe1279d
commit d79a1b7b81
2 changed files with 41 additions and 2 deletions

View File

@@ -17,6 +17,16 @@
past entries belonging to author(s): Viktor Szakats.
*/
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
to create while touching Windows API) for undocumented
SetConsolePalette() hack, following Saulius Zrelskis's
suggestion. Now it doesn't GPF, but it does nothing else
either (could be wrong SYSPAL_ constant, could be anything).
From this point I'll let others continue, or delete all
undocumented code sections.
2010-03-05 18:51 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbmysql/hbmysql.hbc
* contrib/rddsql/sddmy/sddmy.hbc

View File

@@ -742,7 +742,7 @@ static void hb_gt_win_SetPalette_Undoc( HB_BOOL bSet, COLORREF * colors )
{
static HB_BOOL s_bChecked = HB_FALSE;
typedef VOID ( WINAPI * P_SETCONSOLEPALETTE )( COLORREF * );
typedef BOOL ( WINAPI * P_SETCONSOLEPALETTE )( HANDLE, HPALETTE, UINT );
static P_SETCONSOLEPALETTE s_pSetConsolePalette;
if( ! s_bChecked )
@@ -752,7 +752,36 @@ static void hb_gt_win_SetPalette_Undoc( HB_BOOL bSet, COLORREF * colors )
}
if( bSet && s_pSetConsolePalette )
s_pSetConsolePalette( colors );
{
#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