Page 1 of 2

Problem with the TREBAR class on Windows XP (solved)

Posted: Wed Oct 30, 2019 6:39 am
by MaxP
Dear All,

I encountered a problem with the TREBAR class on Windows XP with the latest version of Fivewin.
I know that Windows XP is an outdated operating system but unfortunately I still have clients who use it.
To check the problem, simply compile rebars.prg file in the samples folder.

Code: Select all

#include "FiveWin.ch"

function Main()

   local oWnd, oReBar, oToolBar, oPanel, oBtn1, oFolder, oToolBar2
   local oImageList, oHand

   DEFINE WINDOW oWnd TITLE "Testing rebars and toolbars" ;
      MENU BuildMenu()

   DEFINE CURSOR oHand RESOURCE "hand"

   oReBar = TReBar():New( oWnd )

   oPanel := TPanel():New( 0, 0, 75, 300, oReBar )

   oImageList = TImageList():New()

   oImageList:AddMasked( TBitmap():Define( , "..\bitmaps\16x16\new2.bmp", oWnd ),;
                         nRGB( 255, 0, 255 ) )    
   oImageList:AddMasked( TBitmap():Define( , "..\bitmaps\16x16\open2.bmp", oWnd ),;
                         nRGB( 255, 0, 255 ) )    
   
   oImageList:Add( TBitmap():Define( , "..\bitmaps\16x16\icon.bmp", oWnd ),;
                   TBitmap():Define( , "..\bitmaps\16x16\icoMask.bmp", oWnd ) )

   oToolBar = TToolBar():New( oPanel, 33, 33, oImageList )
   oToolBar:nLeft = 5
   oToolBar:AddButton( { || MsgInfo( "New" ) }, "New" ) // , "new file" )
   oToolBar:AddButton( { || MsgInfo( "Open" ) }, "Open" )
   oToolBar:AddButton( { || MsgInfo( "three" ) }, "three" )
   oToolBar:AddSeparator()
   oToolBar:AddButton( { || MsgInfo( "four" ) }, "four" )
   oToolBar:oCursor = oHand 

   oReBar:InsertBand( oPanel )

   @ 10, 2 FOLDER oFolder PROMPTS "One", "Two", "Three" SIZE 400, 62

   oToolBar2 = TToolBar():New( oFolder:aDialogs[ 1 ],,, oImageList )
   oToolBar2:AddButton( { || MsgInfo( "pointer" ) }, "pointer" )
   oToolBar2:AddSeparator()
   oToolBar2:AddButton( ,"label" )
   oToolBar2:AddButton( ,"button" )

   oReBar:InsertBand( oFolder )

   DEFINE STATUSBAR OF oWnd PROMPT "Rebars and Toolbars test"

   ACTIVATE WINDOW oWnd MAXIMIZED
   
   oImageList:End()

return nil

FUNCTION BuildMenu()

   LOCAL oMenu

   MENU oMenu
      MENUITEM "&File"
      MENU
         MENUITEM "&New..." ACTION MsgInfo( "Hello" )
      ENDMENU
   ENDMENU

RETURN oMenu

Code: Select all

// Add this to your resources RC file

#ifndef __64__
   1 24 ".\WinXP\WindowsXP.Manifest"
#endif

#ifdef __64__
   1 24 "WinXP/WindowsXP.Manifest64"
#endif 

Hand     CURSOR .\..\cursors\Hand.cur
Tools used:
Fivewin 19.09
Borland 5.82

Can someone help me ?


Thanks
Massimo

Re: Problem with the TREBAR class on Windows XP

Posted: Wed Oct 30, 2019 6:57 am
by Antonio Linares
Massimo,

Could you please post a screenshot or send it to my email ? thanks

Re: Problem with the TREBAR class on Windows XP

Posted: Wed Oct 30, 2019 8:25 am
by MaxP
This is the screenshot in Windows 10

Image

This is the screenshot in Windows XP (in practice the bar is not displayed)

Image

Thanks
Massimo

Re: Problem with the TREBAR class on Windows XP

Posted: Wed Oct 30, 2019 8:35 am
by cnavarro
Please, Do not use manifest file in your resource file and try both operating systems

Re: Problem with the TREBAR class on Windows XP

Posted: Wed Oct 30, 2019 8:51 am
by cnavarro
In Windows 10 without the manifest file

Image

Re: Problem with the TREBAR class on Windows XP

Posted: Wed Oct 30, 2019 9:26 am
by MaxP
Hello Cristobal,

if I not use manifest file, the bar does not appear in windows 10 and does not appear in windows xp,
the strange thing is that in the old version of fivewin it worked.

Re: Problem with the TREBAR class on Windows XP

Posted: Wed Oct 30, 2019 9:30 am
by cnavarro
What version did you use before?

Re: Problem with the TREBAR class on Windows XP

Posted: Wed Oct 30, 2019 9:38 am
by MaxP
An old version, the 7.01, I don't know from which version the problem started

Re: Problem with the TREBAR class on Windows XP

Posted: Wed Oct 30, 2019 9:42 am
by MaxP
I found that Günther had the same problem

http://forums.fivetechsupport.com/viewt ... t=xp+rebar

Re: Problem with the TREBAR class on Windows XP

Posted: Wed Oct 30, 2019 9:43 am
by cnavarro
MaxP wrote:An old version, the 7.01, I don't know from which version the problem started
Ok Massimo. Please wait

Re: Problem with the TREBAR class on Windows XP

Posted: Wed Nov 06, 2019 7:18 am
by MaxP
Hello Cristobal,

are there any news respect to this problem?

Re: Problem with the TREBAR class on Windows XP

Posted: Wed Nov 06, 2019 7:51 am
by Antonio Linares
Massimo,

Could you please post a screenshot how it looks with XP and using FWH 7.01 ?

many thanks

Re: Problem with the TREBAR class on Windows XP

Posted: Wed Nov 06, 2019 8:36 am
by MaxP
This is the screenshot how it looks with XP and using FWH 7.01

Image

This is the screenshot how it looks with XP and using FWH 19.09

Image

Thanks

Re: Problem with the TREBAR class on Windows XP

Posted: Fri Nov 08, 2019 5:09 pm
by Antonio Linares
Bug fixed:

The key to solve it is this line at that specific location:
#define _WIN32_WINNT 0x0500

Please add this code to samples\rebars.prg

Code: Select all

#pragma BEGINDUMP

#define _WIN32_WINNT 0x0500
#include <Windows.h>
#include <hbapi.h>
#include <commctrl.h>

HB_FUNC( RBINSERTBAND ) // hReBar, hControl, cText
{
   #ifndef _WIN64
      HWND hReBar = ( HWND ) hb_parnl( 1 );
      HWND hControl = ( HWND ) hb_parnl( 2 );
   #else   
      HWND hReBar = ( HWND ) hb_parnll( 1 );
      HWND hControl = ( HWND ) hb_parnll( 2 );
   #endif   
   REBARBANDINFO rbinfo;
   RECT rct;

   GetWindowRect( hControl, &rct );

   memset( ( char * ) &rbinfo, 0, sizeof( REBARBANDINFO ) );
   rbinfo.cbSize = sizeof( REBARBANDINFO );
   rbinfo.fMask = RBBIM_TEXT | RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE |
                  RBBIM_SIZE;
   rbinfo.fStyle = RBBS_CHILDEDGE;
   rbinfo.lpText = ( LPSTR ) hb_parc( 3 );
   rbinfo.hwndChild = hControl;
   rbinfo.cxMinChild = rct.right - rct.left;
   rbinfo.cyMinChild = rct.bottom - rct.top;
   rbinfo.cx = rct.right - rct.left;

   SendMessage( hReBar, RB_INSERTBAND, ( WPARAM ) -1, ( LPARAM ) &rbinfo );
}

#pragma ENDDUMP
 

Re: Problem with the TREBAR class on Windows XP (solved)

Posted: Mon Nov 11, 2019 8:26 am
by MaxP
Hi Antonio,

now it works properly, thank you for your professionalism

Massimo