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

JsSetProperty

関数
オブジェクトの指定プロパティに値を設定する。
DLLchakra.dll呼出規約winapi

シグネチャ

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

JsErrorCode JsSetProperty(
    void* object,
    void* propertyId,
    void* value,
    BYTE useStrictRules
);

パラメーター

名前方向
objectvoid*in
propertyIdvoid*in
valuevoid*in
useStrictRulesBYTEin

戻り値の型: JsErrorCode

各言語での呼び出し定義

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

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

JsSetProperty = ctypes.windll.chakra.JsSetProperty
JsSetProperty.restype = wintypes.DWORD
JsSetProperty.argtypes = [
    ctypes.POINTER(None),  # object : void*
    ctypes.POINTER(None),  # propertyId : void*
    ctypes.POINTER(None),  # value : void*
    ctypes.c_ubyte,  # useStrictRules : BYTE
]
require 'fiddle'
require 'fiddle/import'

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

var (
	chakra = windows.NewLazySystemDLL("chakra.dll")
	procJsSetProperty = chakra.NewProc("JsSetProperty")
)

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