Help with SystemParametersInfo call

new topic     » topic index » view thread      » older message » newer message

Hi Guys,

I need some help, I am using my window caption bar for some variable text. To
prevent truncation of this I need to detect if the user has his Display
Properties set to "large fonts" (Note not the same as DPI - I can detect that
OK). A google
(http://vbnet.mvps.org/index.html?code/screen/systemparaminfononclientarea.htm)
suggests using a SystemParametersInfo call with SPI_GETNONCLIENTMETRICS. I coded
the following but it fails with a zero return code.
Can anyone tell me where I have gone wrong?

include win32lib.ew
without warning

constant -- LOGFONT struct
     lfHeight            = w32allot( Long ),
    lfWidth             = w32allot( Long ),
    lfEscapement        = w32allot( Long ),
    lfOrientation       = w32allot( Long ),
    lfWeight            = w32allot( Long ),
    lfItalic            = w32allot( Byte ),
    lfUnderline         = w32allot( Byte ),
    lfStrikeOut         = w32allot( Byte ),
    lfCharSet           = w32allot( Byte ),
    lfOutPrecision      = w32allot( Byte ),
    lfClipPrecision     = w32allot( Byte ),
    lfQuality           = w32allot( Byte ),
    lfPitchAndFamily    = w32allot( Byte ),
    lfFaceName          = w32allot( {32, Strz} ),
    SIZEOF_LOGFONT      = w32allotted_size()

constant    -- NONCLIENTMETRICS struct
    NCM_cbSize              = w32allot(Long),
    NCM_iBorderWidth        = w32allot(Long),
    NCM_iScrollWidth        = w32allot(Long),
    NCM_iScrollHeight       = w32allot(Long),
    NCM_iCaptionWidth       = w32allot(Long),
    NCM_iCaptionHeight      = w32allot(Long),
    NCM_lfCaptionFont       = w32allot(Ptr),
    NCM_iSmCaptionWidth     = w32allot(Long),
    NCM_iSmCaptionHeight    = w32allot(Long),
    NCM_lfSmCaptionFont     = w32allot(Ptr),
    NCM_iMenuWidth          = w32allot(Long),
    NCM_iMenuHeight         = w32allot(Long),
    NCM_lfMenuFont          = w32allot(Ptr),
    NCM_lfStatusFont        = w32allot(Ptr),
    NCM_lfMessageFont       = w32allot(Ptr),
    SIZEOF_NCM              = w32allotted_size()

atom memset
atom CaptionFont, SmCaptionFont, MenuFont, StatusFont, MessageFont,
     NCM_struct

memset = w32new_memset()

NCM_struct = w32acquire_mem(memset, SIZEOF_NCM)
CaptionFont = w32acquire_mem(memset, SIZEOF_LOGFONT)
SmCaptionFont = w32acquire_mem(memset, SIZEOF_LOGFONT)
MenuFont = w32acquire_mem(memset, SIZEOF_LOGFONT)
StatusFont = w32acquire_mem(memset, SIZEOF_LOGFONT)
MessageFont = w32acquire_mem(memset, SIZEOF_LOGFONT)

w32store ( NCM_struct, NCM_cbSize, SIZEOF_NCM )
w32store ( NCM_struct, NCM_lfCaptionFont, CaptionFont )
w32store ( NCM_struct, NCM_lfSmCaptionFont, SmCaptionFont )
w32store ( NCM_struct, NCM_lfMenuFont, MenuFont )
w32store ( NCM_struct, NCM_lfStatusFont, StatusFont )
w32store ( NCM_struct, NCM_lfMessageFont, MessageFont )

? w32Func(xSystemParametersInfo,{SPI_GETNONCLIENTMETRICS, SIZEOF_NCM,
NCM_struct, 0})


Regards PeteS

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu