Gdi32 returns Arithmetic errors on Asp.Net RRS feed

  • Question

  • User1643862435 posted


    following the guidance on https://msdn.microsoft.com/en-us/library/dd144885(v=vs.85).aspx 

    "Minimum supported server Windows 2000 Server [desktop apps only]"

    So how am I going to retrieve an embedded Font, say 'Verdana' from the GDI private font collection?

    This is not working on Azure hosted Asp.Net site, on my local PC the byteCount is logical and correct (240456) but the uInt returned from code hosted on Asp.net is out of range (322122506) for byte array.


    System.Drawing.Font gdiFont = font;
    IntPtr hfont = gdiFont.ToHfont();//System.Drawing
    IntPtr hdc = NativeMethods.GetDC(IntPtr.Zero);//user32.dll
    IntPtr oldFont = NativeMethods.SelectObject(hdc, hfont);//gdi32.dll
    uint byteCount = NativeMethods.GetFontData(hdc, nameTableKey, 0, fontData, 0);//gdi32.dll
    Monday, March 16, 2015 12:47 AM

All replies

  • User753101303 posted


    What are you trying to do? .NET functions to get font information are not enough? Also keep in mind that server side fonts are unrelated to the fonts that are found client side. Are you using an Azure VM or an Azure web app? I woudl suspect a 32 bit vs 64 bit issue maybe. What is the return value for GetDC ??? It seems to make little sense for a web app.

    I suspect you might be in a case where what you are doing seems to work on your own machine as both the server and the client are the same while it won't ever work on a real web server.

    Monday, February 1, 2016 3:08 PM