` Printed Icetips Article

Icetips Article



Windows API: Get font size resolution
2003-04-29 -- Jeff Berlinghoff
 
Newsgroups: comp.lang.clarion


> Can anyone recomment the best call to use to determine the screen
resolution
> and font size use?

Can't say this is the *best* way, but it worked for me. I assume when you
say font size, you mean Large Fonts or not?

To determine if large fonts are in use, I used:

 GetDeviceCaps(UNSIGNED, UNSIGNED),UNSIGNED,PASCAL
 GetDC(UNSIGNED),UNSIGNED,PASCAL
 ReleaseDC(UNSIGNED,UNSIGNED),UNSIGNED,PASCAL

 Sample code:
 sh=SYSTEM{Prop:Handle}
 HDC=GetDC(sh)
 fGDC=90
 LargeFonts=CHOOSE(GetDeviceCaps(HDC,fGDC)=120,1,0)
 sh=ReleaseDC(sh,HDC)

To determine the area you have to (re)draw your window in:

       SystemParametersInfo(UShort,UShort,*?,UShort),UShort,Pascal,Raw,|
         Name('SystemParametersInfoA')

WorkArea      GROUP,PRE(WA)
X               Signed
Y               Signed
Width           Signed
Height          Signed
              END

  IF ~SystemParametersInfo(48,0,WorkArea,0)
    RETURN
  END
 ! now you can inspect the WorkArea coordinates

> I need to get this information for automatic window sizing.

I went down this path in Clarion4. Was fun, but never quite completed it.
Good luck.


Jeff Berlinghoff

P.S. You might also want to subclass your windows and watch for event
WM_DISPLAYCHANGE (0x007E) so that you can respond to the user changing
resolutions while your app is running.



Printed November 23, 2024, 3:28 am
This article has been viewed/printed 35217 times.
Google search has resulted in 37 hits on this article since January 25, 2004.