GetCharABCWidths (gdi32)
Last changed: -91.208.24.18

.
Summary

C# Signature:

    [DllImport("gdi32.dll", EntryPoint = "GetCharABCWidthsW", SetLastError = true)]
    static extern unsafe bool GetCharABCWidths(IntPtr hdc, uint uFirstChar,
       uint uLastChar, ABC* lpabc);

User-Defined Types:

    [StructLayout(LayoutKind.Sequential)]
    public struct ABC
    {
        public int abcA;
        public uint abcB;
        public int abcC;

        public override string ToString()
        {
        return string.Format("A={0}, B={1}, C={2}", abcA, abcB, abcC);
        }
    }

Notes:

None.

Tips & Tricks:

The following managed wrapper can be used to get the height of a single character.

    public unsafe ABC GetCharABCWidth(char ch)
    {
        ABC[] abc = new ABC[1];
        fixed (ABC* ar = abc)
        {
        if (!GetCharABCWidths(hdc, (uint)ch, (uint)ch, ar))
        {
            int err = Marshal.GetLastWin32Error();
            throw new Exception("GetCharABCWidthsW failed with code "+err.ToString());
        }
        }
        return abc[0];
    }

Sample Code:

Please add some!

Alternative Managed API:

Do you know one? Please contribute it!

Documentation