在VBA中使用Magnification API获取屏幕放大率

时间:2012-01-06 16:33:25

标签: windows excel winapi vba

我写了一个试图获取屏幕放大率值的小模块。它调用magnification.dll中的一些过程。我想我正确编码,但我得到一个可怕的453错误(找不到入口点)。

以下是代码:

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

我不知道程序别名(不是它需要一个,据我所知别名是可选的)。我试图在我的Excel项目中“检查”Magnification.dll作为参考,但它不会让我。 (无法添加对指定文件的引用)。

连连呢?我只需要拉动放大值。

谢谢!

1 个答案:

答案 0 :(得分:2)

我的Windows 7 magnification.dll导出Mag/UnInitialize但不导出MagGetFullscreenTransformdocs表示最低客户端版本为“Windows Developer Preview”,因此它看起来像win 8功能,我假设你不使用。