Win32 API 日本語リファレンス
ホームSystem.Js › JsGetValueType

JsGetValueType

関数
指定したJavaScript値の型を取得する。
DLLchakra.dll呼出規約winapi

シグネチャ

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

JsErrorCode JsGetValueType(
    void* value,
    JsValueType* type
);

パラメーター

名前方向
valuevoid*in
typeJsValueType*out

戻り値の型: JsErrorCode

各言語での呼び出し定義

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

JsErrorCode JsGetValueType(
    void* value,
    JsValueType* type
);
[DllImport("chakra.dll", ExactSpelling = true)]
static extern uint JsGetValueType(
    IntPtr value,   // void*
    out int type   // JsValueType* out
);
<DllImport("chakra.dll", ExactSpelling:=True)>
Public Shared Function JsGetValueType(
    value As IntPtr,   ' void*
    <Out> ByRef type As Integer   ' JsValueType* out
) As UInteger
End Function
' value : void*
' type : JsValueType* out
Declare PtrSafe Function JsGetValueType Lib "chakra" ( _
    ByVal value As LongPtr, _
    ByRef type As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

JsGetValueType = ctypes.windll.chakra.JsGetValueType
JsGetValueType.restype = wintypes.DWORD
JsGetValueType.argtypes = [
    ctypes.POINTER(None),  # value : void*
    ctypes.c_void_p,  # type : JsValueType* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	chakra = windows.NewLazySystemDLL("chakra.dll")
	procJsGetValueType = chakra.NewProc("JsGetValueType")
)

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