[AccessD] For API experts only

MartyConnelly martyconnelly at shaw.ca
Fri Jul 18 12:26:49 CDT 2003


 Have a look at http://www.allapi.net for further info
but it looks like pixels.

'In general section
Private Declare Function GetClientRect Lib "user32" Alias 
"GetClientRect" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Private Sub Command1_Click()
    'KPD-Team 1998
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam at Allapi.net

    Dim Rectangle as Rect
    'Get the left, top, width and height of this form
    GetClientRect Me.hwnd, Rectangle
    'Show it
    MsgBox "My Width is"+str$(Rectangle.Right - Rectangle.Left)+" 
Pixels."+Chr$(13)+"My Height is"+str$(Rectangle.Bottom - 
Rectangle.Top)+" Pixels."
End sub


Bruce Bruen wrote:

>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