Hi Antonio how are you?
I found a interesting bug in screen coordinates function (at least in windows 11):
---cut---
GetWindowRect( hWnd, &rct );
wWidth = rct.right - rct.left;
wHeight = rct.bottom - rct.top;
---cut---
In windows 11 rct.right is 1374 and rct.left is -8, so 1374 - (-8) give 1382 and the correct is 1366.
I corrected it using abs() : wWidth = rct.right - abs(rct.left);
Please let me know if is this a bug or an expected behavior.
Regards,
Toninho.
Possible bug in some coordinates conversion
-
- Posts: 172
- Joined: Tue Oct 18, 2005 10:01 am
- Antonio Linares
- Site Admin
- Posts: 42597
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 40 times
- Been thanked: 86 times
- Contact:
Re: Possible bug in some coordinates conversion
Dear Toninho,
thats VERY interesting, as these days meanwhile we are implementing the new Method Html() for the controls I noticed something similar, so I am going to check with your suggested fix
many thanks!
thats VERY interesting, as these days meanwhile we are implementing the new Method Html() for the controls I noticed something similar, so I am going to check with your suggested fix

many thanks!
- Antonio Linares
- Site Admin
- Posts: 42597
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 40 times
- Been thanked: 86 times
- Contact:
Re: Possible bug in some coordinates conversion
Maybe you could try to modify this function using longs instead of ints:
Code: Select all | Expand
HB_FUNC( GETWNDRECT ) // hWnd --> { nTop, nLeft, nBottom, nRight }
{
#ifndef _WIN64
HWND hWnd = ( HWND ) hb_parnl( 1 );
#else
HWND hWnd = ( HWND ) hb_parnll( 1 );
#endif
RECT rct;
rct.top = 0;
rct.left = 0;
rct.bottom = 0;
rct.right = 0;
if( hWnd )
GetWindowRect( hWnd, &rct );
hb_reta( 4 );
hb_storvnl( rct.top, -1, 1 ); // changed!
hb_storvnl( rct.left, -1, 2 ); // changed!
hb_storvnl( rct.bottom, -1, 3 ); // changed!
hb_storvnl( rct.right, -1, 4 ); // changed!
}
- Otto
- Posts: 6413
- Joined: Fri Oct 07, 2005 7:07 pm
- Has thanked: 27 times
- Been thanked: 2 times
- Contact:
Re: Possible bug in some coordinates conversion
Dear Antonio,
I get the following error:
But I will install FWH 2022/6 on a clean PC and then test again.
Best regards,
Otto
Stack Calls
===========
Called from: => NUMTOHEX( 0 )
Called from: .\source\function\VALBLANK.PRG => FW_CLRTOHTML( 318 )
Called from: .\source\function\WEBAPP.PRG => CHECKBOXHTML( 389 )
Called from: .\source\function\WEBAPP.PRG => CTRLSHTML( 410 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HTML( 426 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:INITIATE( 954 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 1203 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 306 )
Called from: C:\fwh\samples\testdlg.prg => MAIN( 22 )
I get the following error:
But I will install FWH 2022/6 on a clean PC and then test again.
Best regards,
Otto
Stack Calls
===========
Called from: => NUMTOHEX( 0 )
Called from: .\source\function\VALBLANK.PRG => FW_CLRTOHTML( 318 )
Called from: .\source\function\WEBAPP.PRG => CHECKBOXHTML( 389 )
Called from: .\source\function\WEBAPP.PRG => CTRLSHTML( 410 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HTML( 426 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:INITIATE( 954 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 1203 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 306 )
Called from: C:\fwh\samples\testdlg.prg => MAIN( 22 )
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
- Antonio Linares
- Site Admin
- Posts: 42597
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 40 times
- Been thanked: 86 times
- Contact:
Re: Possible bug in some coordinates conversion
Dear Otto,
Just after you create the DIALOG please do:
oDlg:lHtml = .F.
Please download FWH.exe again and reinstall it
Many thanks
Just after you create the DIALOG please do:
oDlg:lHtml = .F.
Please download FWH.exe again and reinstall it
Many thanks
-
- Posts: 172
- Joined: Tue Oct 18, 2005 10:01 am
Re: Possible bug in some coordinates conversion
Antonio Linares wrote:Maybe you could try to modify this function using longs instead of ints:Code: Select all | Expand
HB_FUNC( GETWNDRECT ) // hWnd --> { nTop, nLeft, nBottom, nRight }
{
...
hb_reta( 4 );
hb_storvnl( rct.top, -1, 1 ); // changed!
hb_storvnl( rct.left, -1, 2 ); // changed!
hb_storvnl( rct.bottom, -1, 3 ); // changed!
hb_storvnl( rct.right, -1, 4 ); // changed!
}
Hi Antonio, thanks for answer, but using longs doesn't help, but I think I found the problem:
https://stackoverflow.com/questions/341 ... le-borders
Regards.