spikepl
Eledittingent Beliped
- Local time
- Today, 09:11
- Joined
- Nov 3, 2010
- Messages
- 6,142
I have following code which works in Office 32:
I need to make this available also for office 64 but my accesss to testing is very limited and also I'm not entirely sure what needs changing , other than adding PTRSAFE.
Some hints are here:
https://msdn.microsoft.com/en-us/library/office/ee691831(v=office.14).aspx
Many of the Long-variables need presumably changing into LongPtr
If you have any knowledge of /confidence in this, then please share.
TIA.
Code:
Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, _
ByVal hdc As Long) As Long
Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, _
ByVal nIndex As Long) As Long
Const HWND_DESKTOP As Long = 0
Const LOGPIXELSX As Long = 88
Const LOGPIXELSY As Long = 90
'--------------------------------------------------
Function TwipsPerPixelX() As Single
'--------------------------------------------------
'Returns the width of a pixel, in twips.
'--------------------------------------------------
Dim lngDC As Long
lngDC = GetDC(HWND_DESKTOP)
TwipsPerPixelX = 1440& / GetDeviceCaps(lngDC, LOGPIXELSX)
ReleaseDC HWND_DESKTOP, lngDC
End Function
'--------------------------------------------------
Function TwipsPerPixelY() As Single
'--------------------------------------------------
'Returns the height of a pixel, in twips.
'--------------------------------------------------
Dim lngDC As Long
lngDC = GetDC(HWND_DESKTOP)
TwipsPerPixelY = 1440& / GetDeviceCaps(lngDC, LOGPIXELSY)
ReleaseDC HWND_DESKTOP, lngDC
End Function
Some hints are here:
https://msdn.microsoft.com/en-us/library/office/ee691831(v=office.14).aspx
Many of the Long-variables need presumably changing into LongPtr
If you have any knowledge of /confidence in this, then please share.
TIA.