[AccessD] For API experts only

Bruce Bruen bbruen at bigpond.com
Sat Jul 19 09:27:35 CDT 2003


Mark & Jim,

Thanks to you both - it was exactly a combination of the two.  I don't
know where the 1370 came from, I just never questioned it and the
toolbar was caused by inadvertantly leaving the Allow Design Changes =
All Views on event though I was killing off the toolbar.

Bruce

From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mitsules,
Mark
Sent: Friday, 18 July 2003 10:46 PM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] For API experts only


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
_______________________________________________
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