Silverfrost Forums

Welcome to our forums

Problem with GetDeviceCaps (SCC)

21 Sep 2020 7:58 #26375

Early this year we updated our ftn95 compiler from version 7.10.0 to version 8.62.0. We have observed different behavior concerning C function 'GetDeviceCaps' concerning parameters HORZRES, VERTRES, DESKTOPHORZRES and DESKTOPVERTRES. Parameters HORZRES and VERTRES provide wrong returns. They are identical to parameters returned when using DESKTOPHORZRES and DESKTOPVERTRES. In this case we are not able to recognize the correct scaling factor.

We use this code for returning the scaling factor under windows 10.

    HDC desktopDc;
    desktopDc = GetDC(NULL);    
    short virtualWidth  = GetDeviceCaps(desktopDc,  HORZRES);
    virtualWidth = (short)(virtualWidth/8)*8;
    short virtualHeight = GetDeviceCaps(desktopDc,  VERTRES);
    virtualHeight = (short)(virtualHeight/8)*8;
    
    short physicalWidth = GetDeviceCaps(desktopDc,  DESKTOPHORZRES);
    short physicalHeight = GetDeviceCaps(desktopDc, DESKTOPVERTRES);
    short dpi = (short)(96.0 * physicalWidth / virtualWidth);
    short sf = 100.0 / 96.0 * dpi;
21 Sep 2020 10:43 #26378

Your code appears to work correctly for me, both for 32 bits and 64 bits.

I will post a message to you that provides a link to the SCC compiler on my machine.

Please login to reply.