デスクトップアイコンの表示要素を取得 <TOP>
デスクトップアイコンの間隔およびタイトルの折り返し状態を取得します。
SystemParametersInfo
システム全体に関するパラメータを取得・設定
'================================================================ '= デスクトップアイコンの表示要素を取得 '= (SystemParametersInfo2.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(LF_FACESIZE - 1) As Byte End Type Type ICONMETRICS cbSize As Long iHorzSpacing As Long iVertSpacing As Long iTitleWrap As Long lfFont As LOGFONT End Type #define SPI_GETICONMETRICS 45 'アイコンに関する寸法情報を定義するICONMETRICS構造体を取得 ' システム全体に関するパラメータを取得・設定 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 im As ICONMETRICS Var iFontName As String Var Ret As Long 'リストボックスをクリア List1.Resetcontent '構造体を初期化 im.cbSize = Len(im) 'アイコンの表示要素を取得 Ret = Api_SystemParametersInfo(SPI_GETICONMETRICS, Len(im), im, 0) 'アイコンの表示要素を表示 List1.AddString "配置の間隔(横):" & Str$(im.iHorzSpacing) List1.AddString "配置の間隔(縦):" & Str$(im.iVertSpacing) If im.iTitleWrap <> False Then List1.AddString "タイトル折返し:" & "有効" Else List1.AddString "タイトル折返し:" & "無効" End If End Sub '================================================================ '= '================================================================ While 1 WaitEvent Wend Stop End