LotusScript で GetSystemInfo() Windows API を Call する場合、(Declarations) に変数として渡す構造体と、Declare ステートメントによる API の呼び出しを書いてあげれば良いです。これを直接 Call できれば CPU の数とか、タイプとか簡単にチェックできますね。
■ Platform SDK: Windows System Information
SYSTEM_INFO
■プラットフォーム SDK
GetSystemInfo
Type SYSTEM_INFO使い方は簡単です。例えば Messagebox に全メンバー値を表示したい場合は、以下のように書けば良いです。
dwOemID As Long
dwPageSize As Long
lpMinimumApplicationAddress As Long
lpMaximumApplicationAddress As Long
dwActiveProcessorMask As Long
dwNumberOfProcessors As Long
dwProcessorType As Long
dwAllocationGranularity As Long
dwProcessorLevel As Integer
dwProcessorRevision As Integer
End Type
Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As SYSTEM_INFO)
Sub Click(Source As Button)NOTE: SYSTEM_INFO 構造体の最初のメンバーは共用体 (union) なんですが、LotusScript で union をうまく扱う方法がわかりませんでした。なので、Windows 2000 などでは Obsolete になっているであろう dwOemID のままにしていますが、もし wProcessorArchitecture をチェックしたい場合は Wrapper 関数を作って OS バージョンにあわせて処理を変更するなどした方が良いのかもしれません。
Dim SysInfo As SYSTEM_INFO
Call GetSystemInfo(SysInfo)
msg$ = "dwOemID:" & Chr(9) & Chr(9) & Chr(9) & SysInfo.dwOemID & Chr(10) &_
"dwPageSize:" & Chr(9) & Chr(9) & SysInfo.dwPageSize & Chr(10) &_
"lpMinimumApplicationAddress:" & Chr(9) & SysInfo.lpMinimumApplicationAddress & Chr(10) &_
"lpMaximumApplicationAddress:" & Chr(9) & SysInfo.lpMaximumApplicationAddress & Chr(10) &_
"dwActiveProcessorMask:" & Chr(9) & SysInfo.dwActiveProcessorMask & Chr(10) &_
"dwNumberOfProcessors:" & Chr(9) & SysInfo.dwNumberOfProcessors & Chr(10) &_
"dwProcessorType:" & Chr(9) & Chr(9) & SysInfo.dwProcessorType & Chr(10) &_
"dwAllocationGranularity:" & Chr(9) & SysInfo.dwAllocationGranularity & Chr(10) &_
"dwProcessorLevel:" & Chr(9) & Chr(9) & SysInfo.dwProcessorLevel & Chr(10) &_
"dwProcessorRevision:" & Chr(9) & Chr(9) & SysInfo.dwProcessorRevision
Msgbox msg$,,"GetSystemInfo()"
End Sub
■ Platform SDK: Windows System Information
SYSTEM_INFO
■プラットフォーム SDK
GetSystemInfo