Win32 API 日本語リファレンス
ホームUI.Shell › IsOS

IsOS

関数
実行中OSのバージョンや種別の条件を判定する。
DLLSHLWAPI.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// SHLWAPI.dll
#include <windows.h>

BOOL IsOS(
    OS dwOS
);

パラメーター

名前方向
dwOSOSin

戻り値の型: BOOL

各言語での呼び出し定義

// SHLWAPI.dll
#include <windows.h>

BOOL IsOS(
    OS dwOS
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHLWAPI.dll", ExactSpelling = true)]
static extern bool IsOS(
    uint dwOS   // OS
);
<DllImport("SHLWAPI.dll", ExactSpelling:=True)>
Public Shared Function IsOS(
    dwOS As UInteger   ' OS
) As Boolean
End Function
' dwOS : OS
Declare PtrSafe Function IsOS Lib "shlwapi" ( _
    ByVal dwOS As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

IsOS = ctypes.windll.shlwapi.IsOS
IsOS.restype = wintypes.BOOL
IsOS.argtypes = [
    wintypes.DWORD,  # dwOS : OS
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SHLWAPI.dll')
IsOS = Fiddle::Function.new(
  lib['IsOS'],
  [
    -Fiddle::TYPE_INT,  # dwOS : OS
  ],
  Fiddle::TYPE_INT)
#[link(name = "shlwapi")]
extern "system" {
    fn IsOS(
        dwOS: u32  // OS
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHLWAPI.dll")]
public static extern bool IsOS(uint dwOS);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_IsOS' -Namespace Win32 -PassThru
# $api::IsOS(dwOS)
#uselib "SHLWAPI.dll"
#func global IsOS "IsOS" sptr
; IsOS dwOS   ; 戻り値は stat
; dwOS : OS -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SHLWAPI.dll"
#cfunc global IsOS "IsOS" int
; res = IsOS(dwOS)
; dwOS : OS -> "int"
; BOOL IsOS(OS dwOS)
#uselib "SHLWAPI.dll"
#cfunc global IsOS "IsOS" int
; res = IsOS(dwOS)
; dwOS : OS -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
	procIsOS = shlwapi.NewProc("IsOS")
)

// dwOS (OS)
r1, _, err := procIsOS.Call(
	uintptr(dwOS),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function IsOS(
  dwOS: DWORD   // OS
): BOOL; stdcall;
  external 'SHLWAPI.dll' name 'IsOS';
result := DllCall("SHLWAPI\IsOS"
    , "UInt", dwOS   ; OS
    , "Int")   ; return: BOOL
●IsOS(dwOS) = DLL("SHLWAPI.dll", "bool IsOS(dword)")
# 呼び出し: IsOS(dwOS)
# dwOS : OS -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。