Fixsays() and the code to patch.obj
Having a problem in using transparent clause and maybe i can come up with a fix.
Thanks
void WindowBoxBlack( HDC hDC, RECT * pRect );
LRESULT static CALLBACK LabelProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
if( uMsg == WM_ERASEBKGND )
{
return 1;
}
else if( uMsg == WM_UPDATEUISTATE ) // SAYs were erased when pressing ALT
{
LONG lResult = CallWindowProc( ( FARPROC ) GetProp( hWnd, "__FWTRANS" ), hWnd, uMsg, wParam, lParam );
InvalidateRect( hWnd, NULL, TRUE );
return lResult;
}
else if( uMsg == WM_PAINT )
{
PAINTSTRUCT ps;
char * text;
int iLen;
RECT rct;
HDC hDC = BeginPaint( hWnd, &ps );
HGDIOBJ hOldFont;
HBRUSH hBrush = ( HBRUSH ) GetProp( hWnd, "__FWBRUSH" );
iLen = GetWindowTextLength( hWnd );
text = ( char * ) hb_xgrab( iLen + 1 );
GetWindowText( hWnd, text, iLen + 1 );
GetClientRect( hWnd, &rct );
SetBkMode( hDC, TRANSPARENT );
SelectObject( hDC, GetStockObject( DEFAULT_GUI_FONT ) );
SendMessage( GetParent( hWnd ), WM_CTLCOLORSTATIC, ( WPARAM ) hDC, ( LPARAM ) hWnd );
hOldFont = SelectObject( hDC, ( HGDIOBJ ) SendMessage( hWnd, WM_GETFONT, 0, 0 ) );
if( ! IsWindowEnabled( hWnd ) )
SetTextColor( hDC, GetSysColor( COLOR_GRAYTEXT ) );
FillRect( hDC, &rct, hBrush );
if( ( GetWindowLong( hWnd, GWL_STYLE ) & SS_BLACKFRAME ) == SS_BLACKFRAME )
{
WindowBoxBlack( hDC, &rct );
}
else if( GetWindowLong( hWnd, GWL_STYLE ) & SS_CENTER )
DrawText( hDC, text, iLen, &rct, DT_CENTER | DT_WORDBREAK );
else if( GetWindowLong( hWnd, GWL_STYLE ) & SS_RIGHT )
DrawText( hDC, text, iLen, &rct, DT_RIGHT | DT_WORDBREAK );
else if( GetWindowLong( hWnd, GWL_STYLE ) & SS_LEFTNOWORDWRAP )
DrawText( hDC, text, iLen, &rct, DT_LEFT );
else
DrawText( hDC, text, iLen, &rct, DT_LEFT | DT_WORDBREAK );
SelectObject( hDC, hOldFont );
hb_xfree( text );
EndPaint( hWnd, &ps );
return 0;
}
else
return CallWindowProc( ( FARPROC ) GetProp( hWnd, "__FWTRANS" ), hWnd, uMsg, wParam, lParam );
}
HB_FUNC( FIXSAYS )
{
HWND hDlg = ( HWND ) hb_parnl( 1 );
HBRUSH hBrush = ( HBRUSH ) hb_parnl( 2 );
HWND hCtrl = GetWindow( hDlg, GW_CHILD );
char className[ 64 ];
WNDPROC pLabelProc;
while( hCtrl != NULL )
{
GetClassName( hCtrl, className, sizeof( className ) );
if( ! lstrcmp( "Static", className ) && ! ( ( GetWindowLong( hCtrl, GWL_STYLE ) & SS_ICON ) == SS_ICON )
&& ! ( ( GetWindowLong( hCtrl, GWL_STYLE ) & SS_ETCHEDHORZ ) == SS_ETCHEDHORZ ) )
{
#ifndef _WIN64
if( GetWindowLong( hCtrl, GWL_WNDPROC ) != ( LONG ) LabelProc )
{
pLabelProc = ( WNDPROC ) SetWindowLong( hCtrl, GWL_WNDPROC,
( LONG ) LabelProc );
SetProp( hCtrl, "__FWTRANS", ( HANDLE ) pLabelProc );
SetProp( hCtrl, "__FWBRUSH", ( HANDLE ) hBrush );
}
#else
if( GetWindowLongPtr( hCtrl, GWLP_WNDPROC ) != ( LONGLONG ) LabelProc )
{
pLabelProc = ( WNDPROC ) SetWindowLongPtr( hCtrl, GWLP_WNDPROC,
( LONGLONG ) LabelProc );
SetProp( hCtrl, "__FWTRANS", ( HANDLE ) pLabelProc );
SetProp( hCtrl, "__FWBRUSH", ( HANDLE ) hBrush );
}
#endif
}
hCtrl = GetWindow( hCtrl, GW_HWNDNEXT );
}
}
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
void WindowBoxBlack( HDC hDC, RECT * pRect );
LRESULT static CALLBACK LabelProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
if( uMsg == WM_ERASEBKGND )
{
return 1;
}
else if( uMsg == WM_UPDATEUISTATE ) // SAYs were erased when pressing ALT
{
LONG lResult = CallWindowProc( ( FARPROC ) GetProp( hWnd, "__FWTRANS" ), hWnd, uMsg, wParam, lParam );
InvalidateRect( hWnd, NULL, TRUE );
return lResult;
}
else if( uMsg == WM_PAINT )
{
PAINTSTRUCT ps;
char * text;
int iLen;
RECT rct;
HDC hDC = BeginPaint( hWnd, &ps );
HGDIOBJ hOldFont;
HBRUSH hBrush = ( HBRUSH ) GetProp( hWnd, "__FWBRUSH" );
iLen = GetWindowTextLength( hWnd );
text = ( char * ) hb_xgrab( iLen + 1 );
GetWindowText( hWnd, text, iLen + 1 );
GetClientRect( hWnd, &rct );
SetBkMode( hDC, TRANSPARENT );
SelectObject( hDC, GetStockObject( DEFAULT_GUI_FONT ) );
SendMessage( GetParent( hWnd ), WM_CTLCOLORSTATIC, ( WPARAM ) hDC, ( LPARAM ) hWnd );
hOldFont = SelectObject( hDC, ( HGDIOBJ ) SendMessage( hWnd, WM_GETFONT, 0, 0 ) );
if( ! IsWindowEnabled( hWnd ) )
SetTextColor( hDC, GetSysColor( COLOR_GRAYTEXT ) );
// FillRect( hDC, &rct, hBrush );
if( ( GetWindowLong( hWnd, GWL_STYLE ) & SS_BLACKFRAME ) == SS_BLACKFRAME )
{
WindowBoxBlack( hDC, &rct );
}
else if( GetWindowLong( hWnd, GWL_STYLE ) & SS_CENTER )
DrawText( hDC, text, iLen, &rct, DT_CENTER | DT_WORDBREAK );
else if( GetWindowLong( hWnd, GWL_STYLE ) & SS_RIGHT )
DrawText( hDC, text, iLen, &rct, DT_RIGHT | DT_WORDBREAK );
else if( GetWindowLong( hWnd, GWL_STYLE ) & SS_LEFTNOWORDWRAP )
DrawText( hDC, text, iLen, &rct, DT_LEFT );
else
DrawText( hDC, text, iLen, &rct, DT_LEFT | DT_WORDBREAK );
SelectObject( hDC, hOldFont );
hb_xfree( text );
EndPaint( hWnd, &ps );
return 0;
}
else
return CallWindowProc( ( FARPROC ) GetProp( hWnd, "__FWTRANS" ), hWnd, uMsg, wParam, lParam );
}
HB_FUNC( FIXSAYS )
{
HWND hDlg = ( HWND ) hb_parnl( 1 );
HBRUSH hBrush = ( HBRUSH ) hb_parnl( 2 );
HWND hCtrl = GetWindow( hDlg, GW_CHILD );
char className[ 64 ];
WNDPROC pLabelProc;
while( hCtrl != NULL )
{
GetClassName( hCtrl, className, sizeof( className ) );
if( ! lstrcmp( "Static", className ) && ! ( ( GetWindowLong( hCtrl, GWL_STYLE ) & SS_ICON ) == SS_ICON )
&& ! ( ( GetWindowLong( hCtrl, GWL_STYLE ) & SS_ETCHEDHORZ ) == SS_ETCHEDHORZ ) )
{
#ifndef _WIN64
if( GetWindowLong( hCtrl, GWL_WNDPROC ) != ( LONG ) LabelProc )
{
pLabelProc = ( WNDPROC ) SetWindowLong( hCtrl, GWL_WNDPROC,
( LONG ) LabelProc );
SetProp( hCtrl, "__FWTRANS", ( HANDLE ) pLabelProc );
SetProp( hCtrl, "__FWBRUSH", ( HANDLE ) hBrush );
}
#else
if( GetWindowLongPtr( hCtrl, GWLP_WNDPROC ) != ( LONGLONG ) LabelProc )
{
pLabelProc = ( WNDPROC ) SetWindowLongPtr( hCtrl, GWLP_WNDPROC,
( LONGLONG ) LabelProc );
SetProp( hCtrl, "__FWTRANS", ( HANDLE ) pLabelProc );
SetProp( hCtrl, "__FWBRUSH", ( HANDLE ) hBrush );
}
#endif
}
hCtrl = GetWindow( hCtrl, GW_HWNDNEXT );
}
}
#pragma ENDDUMP
F:\color>gl
F:\color>if not exist obj md obj
F:\color>c:\Borland\bcc55\bin\make -fcash.rmk
MAKE Version 5.2 Copyright (c) 1987, 2000 Borland
f:\harbour\bin\harbour .\cashver3.PRG /b /N /W /Oobj\ /If:\fwh89\include
;f:\harbour\include > clip.log
Harbour 1.0.1dev Intl. (Rev. 9361)
Copyright (c) 1999-2008, http://www.harbour-project.org/
Compiling '.\cashver3.PRG'...
Lines 14783, Functions/Procedures 103
Generating C source output to 'obj\cashver3.c'... Done.
c:\borland\bcc55\bin\bcc32 -c -tWM -If:\harbour\include -oobj\cashver3 o
bj\cashver3.c
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
obj\cashver3.c:
Error E2342 .\\cashver3.PRG 10759: Type mismatch in parameter 'lpPrevWndFunc' (w
anted 'long (__stdcall *)(HWND__ *,unsigned int,unsigned int,long)', got 'int (_
_stdcall *)()') in function LabelProc
Warning W8004 .\\cashver3.PRG 10813: 'hBrush' is assigned a value that is never
used in function LabelProc
Error E2342 .\\cashver3.PRG 10815: Type mismatch in parameter 'lpPrevWndFunc' (w
anted 'long (__stdcall *)(HWND__ *,unsigned int,unsigned int,long)', got 'int (_
_stdcall *)()') in function LabelProc
*** 2 errors in Compile ***
** error 1 ** deleting .\obj\cashver3.OBJ
F:\color>rem if not errorlevel 1 cashvr11
F:\color>
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
void WindowBoxBlack( HDC hDC, RECT * pRect );
LRESULT static CALLBACK LabelProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
if( uMsg == WM_ERASEBKGND )
{
return 1;
}
else if( uMsg == WM_UPDATEUISTATE ) // SAYs were erased when pressing ALT
{
LONG lResult = CallWindowProc( ( WNDPROC ) GetProp( hWnd, "__FWTRANS" ), hWnd, uMsg, wParam, lParam );
InvalidateRect( hWnd, NULL, TRUE );
return lResult;
}
else if( uMsg == WM_PAINT )
{
PAINTSTRUCT ps;
char * text;
int iLen;
RECT rct;
HDC hDC = BeginPaint( hWnd, &ps );
HGDIOBJ hOldFont;
HBRUSH hBrush = ( HBRUSH ) GetProp( hWnd, "__FWBRUSH" );
iLen = GetWindowTextLength( hWnd );
text = ( char * ) hb_xgrab( iLen + 1 );
GetWindowText( hWnd, text, iLen + 1 );
GetClientRect( hWnd, &rct );
SetBkMode( hDC, TRANSPARENT );
SelectObject( hDC, GetStockObject( DEFAULT_GUI_FONT ) );
SendMessage( GetParent( hWnd ), WM_CTLCOLORSTATIC, ( WPARAM ) hDC, ( LPARAM ) hWnd );
hOldFont = SelectObject( hDC, ( HGDIOBJ ) SendMessage( hWnd, WM_GETFONT, 0, 0 ) );
if( ! IsWindowEnabled( hWnd ) )
SetTextColor( hDC, GetSysColor( COLOR_GRAYTEXT ) );
// FillRect( hDC, &rct, hBrush );
if( ( GetWindowLong( hWnd, GWL_STYLE ) & SS_BLACKFRAME ) == SS_BLACKFRAME )
{
WindowBoxBlack( hDC, &rct );
}
else if( GetWindowLong( hWnd, GWL_STYLE ) & SS_CENTER )
DrawText( hDC, text, iLen, &rct, DT_CENTER | DT_WORDBREAK );
else if( GetWindowLong( hWnd, GWL_STYLE ) & SS_RIGHT )
DrawText( hDC, text, iLen, &rct, DT_RIGHT | DT_WORDBREAK );
else if( GetWindowLong( hWnd, GWL_STYLE ) & SS_LEFTNOWORDWRAP )
DrawText( hDC, text, iLen, &rct, DT_LEFT );
else
DrawText( hDC, text, iLen, &rct, DT_LEFT | DT_WORDBREAK );
SelectObject( hDC, hOldFont );
hb_xfree( text );
EndPaint( hWnd, &ps );
return 0;
}
else
return CallWindowProc( ( FARPROC ) GetProp( hWnd, "__FWTRANS" ), hWnd, uMsg, wParam, lParam );
}
HB_FUNC( FIXSAYS )
{
HWND hDlg = ( HWND ) hb_parnl( 1 );
HBRUSH hBrush = ( HBRUSH ) hb_parnl( 2 );
HWND hCtrl = GetWindow( hDlg, GW_CHILD );
char className[ 64 ];
WNDPROC pLabelProc;
while( hCtrl != NULL )
{
GetClassName( hCtrl, className, sizeof( className ) );
if( ! lstrcmp( "Static", className ) && ! ( ( GetWindowLong( hCtrl, GWL_STYLE ) & SS_ICON ) == SS_ICON )
&& ! ( ( GetWindowLong( hCtrl, GWL_STYLE ) & SS_ETCHEDHORZ ) == SS_ETCHEDHORZ ) )
{
#ifndef _WIN64
if( GetWindowLong( hCtrl, GWL_WNDPROC ) != ( LONG ) LabelProc )
{
pLabelProc = ( WNDPROC ) SetWindowLong( hCtrl, GWL_WNDPROC,
( LONG ) LabelProc );
SetProp( hCtrl, "__FWTRANS", ( HANDLE ) pLabelProc );
SetProp( hCtrl, "__FWBRUSH", ( HANDLE ) hBrush );
}
#else
if( GetWindowLongPtr( hCtrl, GWLP_WNDPROC ) != ( LONGLONG ) LabelProc )
{
pLabelProc = ( WNDPROC ) SetWindowLongPtr( hCtrl, GWLP_WNDPROC,
( LONGLONG ) LabelProc );
SetProp( hCtrl, "__FWTRANS", ( HANDLE ) pLabelProc );
SetProp( hCtrl, "__FWBRUSH", ( HANDLE ) hBrush );
}
#endif
}
hCtrl = GetWindow( hCtrl, GW_HWNDNEXT );
}
}
#pragma ENDDUMP
F:\color>c:\Borland\bcc55\bin\make -fcash.rmk
MAKE Version 5.2 Copyright (c) 1987, 2000 Borland
f:\harbour\bin\harbour .\cashver3.PRG /b /N /W /Oobj\ /If:\fwh89\include
;f:\harbour\include > clip.log
Harbour 1.0.1dev Intl. (Rev. 9361)
Copyright (c) 1999-2008, http://www.harbour-project.org/
Compiling '.\cashver3.PRG'...
Lines 14905, Functions/Procedures 103
Generating C source output to 'obj\cashver3.c'... Done.
c:\borland\bcc55\bin\bcc32 -c -tWM -If:\harbour\include -oobj\cashver3 o
bj\cashver3.c
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
obj\cashver3.c:
Warning W8004 .\\cashver3.PRG 10934: 'hBrush' is assigned a value that is never
used in function LabelProc
Error E2342 .\\cashver3.PRG 10936: Type mismatch in parameter 'lpPrevWndFunc' (w
anted 'long (__stdcall *)(HWND__ *,unsigned int,unsigned int,long)', got 'int (_
_stdcall *)()') in function LabelProc
*** 1 errors in Compile ***
** error 1 ** deleting .\obj\cashver3.OBJ
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 40 guests