[AccessD] For API experts only

Mitsules, Mark Mark.Mitsules at ngc.com
Fri Jul 18 07:46:29 CDT 2003


I've used 1440 twips per inch, not 1370.



Mark


-----Original Message-----
From: Bruce Bruen [mailto:bbruen at bigpond.com] 
Sent: Friday, July 18, 2003 8:27 AM
To: accessd at databaseadvisors.com
Subject: [AccessD] For API experts only


Hey list,

Can anyone tell me what units the following call returns:
	Private Declare Function GetClientRect Lib "user32.dll" (ByVal hwnd
As Long, lpRect As RECT) As Long

Private Type RECT
    wLeft As Long
    wTop As Long
    wRight As Long
    wBottom As Long
End Type

I am trying to set a form detail section height to the maximum available
height in the access client window. To do this I am using
	Private Declare Function GetParent Lib "user32.dll" (ByVal hwnd As
Long) As Long to get the forms parent window, which appears to have the same
hwnd as the Access app MDI client ( as per the Ashsish/Kreft class info
wizard), and which I thus presume is the window I am looking for.  Then I
treat it thus:

    lRtn = GetClientRect(GetParent(Me.hwnd), wParRECT)
    wincliHeight = wParRect.wBottom * TwipsPerPixelY

Where 

Function TwipsPerPixelY() As Single
'Returns the height of a pixel, in twips.
' This code is from the great but defunct AllAPI team, I think.

    Const HWND_DESKTOP As Long = 0
    Const LOGPIXELSY As Long = 90
  
    Dim lngDC As Long
    
    lngDC = GetDC(HWND_DESKTOP)
    TwipsPerPixelY = 1370& / GetDeviceCaps(lngDC, LOGPIXELSY) 'LOGPIXELSY=
Number of pixels per logical inch along the screen height.
    ReleaseDC HWND_DESKTOP, lngDC
End Function

However, this gets me a detail section size that is almost, but not quite,
right.  Its out by about 1cm! 

The screen is running at 1024x768 res.  TwipsPerPixelY returns 14.something.

Any ideas?
Tia
Bruce

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list