简体   繁体   中英

vista/win7 magnification API in .NET

There is magnification.lib in the Win7/Vista SDK for using Magnification API for C++. How can I use this API in a .NET windows forms project?

You need to use P/Invoke for this task. Have a look at the below C# code snippet:

[DllImport("Magnification.dll"]
static extern bool MagInitialize();
...
[DllImport("Magnification.dll"]
static extern bool MagUninitialize();

void Main()
{
    if (MagInitialize())
    {
        DoSomething();
    }
    ...
    MagUnitialize();
}

Here you declare all the methods you need to use in you WinForms app and then you call them just as if they were ordinary methods. You can find many useful information and samples on pinvoke.net web site. Please also note that you don't need Magnification.lib at all, it is the library for linking with an unmanaged C/С++ code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM