forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with GetDeviceCaps (SCC)

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
dgurok



Joined: 26 May 2011
Posts: 66

PostPosted: Mon Sep 21, 2020 8:58 am    Post subject: Problem with GetDeviceCaps (SCC) Reply with quote

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.

Code:
    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;
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Mon Sep 21, 2020 11:43 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group