Need copy of the following functions if any body has them.

Need copy of the following functions if any body has them.

Postby hag » Sat Dec 17, 2011 2:04 am

Fixsays() and the code to patch.obj

Having a problem in using transparent clause and maybe i can come up with a fix.

Thanks
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: Need copy of the following functions if any body has them.

Postby Antonio Linares » Sun Dec 18, 2011 6:47 pm

Harvey,

Here you have FixSays() source code:

Code: Select all  Expand view
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 );
   }
}

 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42086
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Need copy of the following functions if any body has them.

Postby hag » Sun Dec 18, 2011 8:33 pm

Antion:

Thanks for sendingh me the code. I think its out of my league.
Is there a fix I can use: When using the transparent clause the last letter in a defined and undefined say is dropped.
To correct this a may have a 500+ undefined says that now require me to define them to change there color.

Using fwh 89

any help will be appreciated.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: Need copy of the following functions if any body has them.

Postby Antonio Linares » Sun Dec 18, 2011 9:36 pm

Harvey,

Please copy this code at the bottom of your main PRG:

Code: Select all  Expand view

#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
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42086
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Need copy of the following functions if any body has them.

Postby hag » Sun Dec 18, 2011 9:59 pm

Antonio: thanks for the help. I get the following compile errors:


Code: Select all  Expand view

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>

















 
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: Need copy of the following functions if any body has them.

Postby Antonio Linares » Mon Dec 19, 2011 9:35 am

Harvey,

Please replace this line:

LONG lResult = CallWindowProc( ( FARPROC ) GetProp( hWnd, "__FWTRANS" ), hWnd, uMsg, wParam, lParam );

with:

LONG lResult = CallWindowProc( ( WNDPROC ) GetProp( hWnd, "__FWTRANS" ), hWnd, uMsg, wParam, lParam );
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42086
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Need copy of the following functions if any body has them.

Postby hag » Mon Dec 19, 2011 3:50 pm

Made the change. Code I'm using :

Code: Select all  Expand view
#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




Eerrors receiving
Code: Select all  Expand view
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
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: Need copy of the following functions if any body has them.

Postby Antonio Linares » Mon Dec 19, 2011 5:48 pm

Harvey,

Also change this line:

return CallWindowProc( ( FARPROC ) GetProp( hWnd, "__FWTRANS" ), hWnd, uMsg, wParam, lParam );

with:

return CallWindowProc( ( WNDPROC ) GetProp( hWnd, "__FWTRANS" ), hWnd, uMsg, wParam, lParam );
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42086
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Need copy of the following functions if any body has them.

Postby hag » Tue Dec 20, 2011 12:23 am

Antinio it works perfectly. Thannks for you help.

Have a great chrismas and new year.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: Need copy of the following functions if any body has them.

Postby Antonio Linares » Tue Dec 20, 2011 7:38 am

Very good :-)

Merry christmas,
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42086
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 81 guests