Win32 API 日本語リファレンス
ホームNetworking.WinHttp › WinHttpCheckPlatform

WinHttpCheckPlatform

関数
現在のプラットフォームがWinHTTPに対応するか確認する。
DLLWINHTTP.dll呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

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

BOOL WinHttpCheckPlatform(void);

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

各言語での呼び出し定義

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

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

WinHttpCheckPlatform = ctypes.windll.winhttp.WinHttpCheckPlatform
WinHttpCheckPlatform.restype = wintypes.BOOL
WinHttpCheckPlatform.argtypes = []
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

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

var (
	winhttp = windows.NewLazySystemDLL("WINHTTP.dll")
	procWinHttpCheckPlatform = winhttp.NewProc("WinHttpCheckPlatform")
)

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