非クライアント領域の表示要素を取得 <TOP>
SystemParametersInfo
システム全体に関するパラメータを取得・設定
SPI_GETNONCLIENTMETRICS(41)
NONCLIENTMETRICS構造体を取得
'================================================================ '= 非クライアント領域の表示要素を取得 '= (NonClientMetrics.bas) '================================================================ #include "Windows.bi" #define LF_FACESIZE 32 Type LOGFONT lfHeight As Long lfWidth As Long lfEscapement As Long lfOrientation As Long lfWeight As Long lfItalic As Byte lfUnderline As Byte lfStrikeOut As Byte lfCharSet As Byte lfOutPrecision As Byte lfClipPrecision As Byte lfQuality As Byte lfPitchAndFamily As Byte lfFaceName As String * LF_FACESIZE End Type Type NONCLIENTMETRICS cbSize As Long iBorderWidth As Long iScrollWidth As Long iScrollHeight As Long iCaptionWidth As Long iCaptionHeight As Long lfCaptionFont As LOGFONT iSmCaptionWidth As Long iSmCaptionHeight As Long lfSmCaptionFont As LOGFONT iMenuWidth As Long iMenuHeight As Long lfMenuFont As LOGFONT lfStatusFont As LOGFONT lfMessageFont As LOGFONT End Type #define SPI_GETNONCLIENTMETRICS 41 '非クライアント領域に関する情報を定義するNONCLIENTMETRICS構造体を取得 ' システム全体に関するパラメータを取得・設定 Declare Function Api_SystemParametersInfo& Lib "user32" Alias "SystemParametersInfoA" (ByVal uiAction&, ByVal uiParam&, pvParam As Any, ByVal fWinIni&) Var Shared List1 As Object Var Shared Button1 As Object List1.Attach GetDlgItem("List1") : List1.SetFontSize 14 Button1.Attach GetDlgItem("Button1") : Button1.setFontSize 14 '================================================================ '= '================================================================ Declare Sub Button1_on edecl () Sub Button1_on() Var ncm As NONCLIENTMETRICS Var ContainFontName As String Var MenuBarFontName As String Var StatusBarFontName As String Var MsgBoxFontName As String Var Ret As Long 'リストボックスをクリア List1.ResetContent '非クライアント領域の表示要素を定義する構造体を初期化 ncm.cbSize = Len(ncm) '非クライアント領域の表示要素を取得 Ret = Api_SystemParametersInfo(SPI_GETNONCLIENTMETRICS, Len(ncm), ncm, 0) '非クライアント領域の表示要素を表示 ContainFontName = ncm.lfCaptionFont.lfFaceName List1.AddString "キャプション : " & Left$(ContainFontName, InStr(ContainFontName, Chr$(0)) - 1) List1.AddString "キャプション(幅) : " & Trim$(Str$(ncm.iCaptionWidth)) List1.AddString "キャプション(高さ): " & Trim$(Str$(ncm.iCaptionHeight)) StatusBarFontName = ncm.lfStatusFont.lfFaceName MenuBarFontName = ncm.lfMenuFont.lfFaceName List1.AddString "メニューバー : " & Left$(MenuBarFontName, InStr(MenuBarFontName, Chr$(0)) - 1) List1.AddString "メニューバー(幅) : " & Trim$(Str$(ncm.iMenuWidth)) List1.AddString "メニューバー(高さ): " & Trim$(Str$(ncm.iMenuHeight)) List1.AddString "ステータスバー : " & Left$(StatusBarFontName, InStr(StatusBarFontName, Chr$(0)) - 1) MsgBoxFontName = ncm.lfMessageFont.lfFaceName List1.AddString "メッセージボックス: " & Left$(MsgBoxFontName, InStr(MsgBoxFontName, Chr$(0)) - 1) End Sub '================================================================ '= '================================================================ While 1 WaitEvent Wend Stop End