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

WhichPlatform

関数
実行環境のシェルプラットフォーム種別を取得する。
DLLSHLWAPI.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

DWORD WhichPlatform(void);

パラメーターなし。戻り値: DWORD

各言語での呼び出し定義

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

DWORD WhichPlatform(void);
[DllImport("SHLWAPI.dll", ExactSpelling = true)]
static extern uint WhichPlatform();
<DllImport("SHLWAPI.dll", ExactSpelling:=True)>
Public Shared Function WhichPlatform() As UInteger
End Function
Declare PtrSafe Function WhichPlatform Lib "shlwapi" () As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WhichPlatform = ctypes.windll.shlwapi.WhichPlatform
WhichPlatform.restype = wintypes.DWORD
WhichPlatform.argtypes = []
require 'fiddle'
require 'fiddle/import'

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

var (
	shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
	procWhichPlatform = shlwapi.NewProc("WhichPlatform")
)

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