Client to Screen

Client to Screen

Postby nageswaragunupudi » Tue Apr 08, 2008 9:39 am

We often find this kind of correction to the coordinates returned by ClientToScreen and SceenToClient functions
Code: Select all  Expand view  RUN
      aPoint = ClientToScreen( ::hWnd, aPoint )
      if aPoint[ 1 ] > 32768
         aPoint[ 1 ] -= 65535
      endif
      if aPoint[ 2 ] > 32768
         aPoint[ 2 ] -= 65535
      endif

It is also advised in these forums to use the correction after call to these functions. Why can't the correction be built into the FWH functions ClientToScreen and SceenToClient, so that we do not have to write the extra repetitive code ? Incorporating these corrections in the main code does not break any existing code.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10645
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby Antonio Linares » Tue Apr 08, 2008 1:29 pm

NageswaraRao,

In those circunstances we need a "short" (16 bits) signed value from PRG level.

Maybe we could try to change:
Code: Select all  Expand view  RUN
   hb_reta( 2 );
   hb_stornl( pt.x, -1, 2 );
   hb_stornl( pt.y, -1, 1 )

into:
Code: Select all  Expand view  RUN
   hb_reta( 2 );
   hb_storni( ( short int ) pt.x, -1, 2 );
   hb_storni( ( short int ) pt.y, -1, 1 )
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: wilsongamboa and 88 guests