Harry
Harry

Reputation: 256

using Magnification API in VBA to get the screen magnification

I wrote a little module that tries to get the screen magnification value. It calls some procedures in the magnification.dll . I think i'm coding it correctly, but i'm getting a dreaded 453 error (can't find entry point).

Here's the code:

Public Declare Function MagInitialize Lib "magnification.dll" () As Boolean
Public Declare Function MagUninitialize Lib "magnification.dll" () As Boolean
Public Declare Function MagGetFullscreenTransform Lib "magnification.dll" _
(ByVal pMagLevel As Single, ByVal pxOffset As Integer, ByVal pyOffset As Integer) As Boolean '

Sub test123()
 Dim sngValue As Single, intX As Integer, intY As Integer
 If (MagInitialize) Then
    If MagGetFullscreenTransform(sngValue, intX, intY) Then    '
        Debug.Print sngValue & " was returned from MagGetFullscreenTransform. "
    Else
        Debug.Print "MagGetFullscreenTransform was false."
    End If
 Else
    Debug.Print "Can't initialize"
 End If

 If Not (MagUninitialize) Then
    Debug.Print "Can't uninitialize"
 End If

 End Sub

I don't know the procedure alias (not that it needs one, as far as I know alias is optional). I've tried to "check" Magnification.dll as a reference in my Excel project, but it won't let me. (Can't add a reference to the specified file).

Suggestions? I just need to pull the magnfication value.

thanks!

Upvotes: 1

Views: 1068

Answers (1)

Alex K.
Alex K.

Reputation: 175748

My windows 7 magnification.dll exports Mag/UnInitialize but does not export MagGetFullscreenTransform, the docs say the minimum client version is "Windows Developer Preview" so it looks like a win 8 feature, which I assume your not using.

Upvotes: 2

Related Questions