Problem with the TREBAR class on Windows XP (solved)

User avatar
MaxP
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm
Contact:

Problem with the TREBAR class on Windows XP (solved)

Post 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
Last edited by MaxP on Mon Nov 11, 2019 8:24 am, edited 1 time in total.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Problem with the TREBAR class on Windows XP

Post by Antonio Linares »

Massimo,

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

Antonio Linares
www.fivetechsoft.com
User avatar
MaxP
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm
Contact:

Re: Problem with the TREBAR class on Windows XP

Post 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
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Problem with the TREBAR class on Windows XP

Post by cnavarro »

Please, Do not use manifest file in your resource file and try both operating systems
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Problem with the TREBAR class on Windows XP

Post by cnavarro »

In Windows 10 without the manifest file

Image
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
MaxP
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm
Contact:

Re: Problem with the TREBAR class on Windows XP

Post 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.
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Problem with the TREBAR class on Windows XP

Post by cnavarro »

What version did you use before?
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
MaxP
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm
Contact:

Re: Problem with the TREBAR class on Windows XP

Post by MaxP »

An old version, the 7.01, I don't know from which version the problem started
User avatar
MaxP
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm
Contact:

Re: Problem with the TREBAR class on Windows XP

Post by MaxP »

I found that Günther had the same problem

http://forums.fivetechsupport.com/viewt ... t=xp+rebar
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Problem with the TREBAR class on Windows XP

Post by cnavarro »

MaxP wrote:An old version, the 7.01, I don't know from which version the problem started
Ok Massimo. Please wait
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
MaxP
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm
Contact:

Re: Problem with the TREBAR class on Windows XP

Post by MaxP »

Hello Cristobal,

are there any news respect to this problem?
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Problem with the TREBAR class on Windows XP

Post by Antonio Linares »

Massimo,

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

many thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
MaxP
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm
Contact:

Re: Problem with the TREBAR class on Windows XP

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Problem with the TREBAR class on Windows XP

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

Antonio Linares
www.fivetechsoft.com
User avatar
MaxP
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm
Contact:

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

Post by MaxP »

Hi Antonio,

now it works properly, thank you for your professionalism

Massimo
Post Reply