ホーム › System.Ole › VarI1FromBool
VarI1FromBool
関数VARIANT_BOOL値を符号付き1バイト整数に変換する。
シグネチャ
// OLEAUT32.dll
#include <windows.h>
HRESULT VarI1FromBool(
VARIANT_BOOL boolIn,
LPSTR pcOut
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| boolIn | VARIANT_BOOL | in |
| pcOut | LPSTR | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// OLEAUT32.dll
#include <windows.h>
HRESULT VarI1FromBool(
VARIANT_BOOL boolIn,
LPSTR pcOut
);[DllImport("OLEAUT32.dll", ExactSpelling = true)]
static extern int VarI1FromBool(
short boolIn, // VARIANT_BOOL
[MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder pcOut // LPSTR out
);<DllImport("OLEAUT32.dll", ExactSpelling:=True)>
Public Shared Function VarI1FromBool(
boolIn As Short, ' VARIANT_BOOL
<MarshalAs(UnmanagedType.LPStr)> pcOut As System.Text.StringBuilder ' LPSTR out
) As Integer
End Function' boolIn : VARIANT_BOOL
' pcOut : LPSTR out
Declare PtrSafe Function VarI1FromBool Lib "oleaut32" ( _
ByVal boolIn As Integer, _
ByVal pcOut As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
VarI1FromBool = ctypes.windll.oleaut32.VarI1FromBool
VarI1FromBool.restype = ctypes.c_int
VarI1FromBool.argtypes = [
ctypes.c_short, # boolIn : VARIANT_BOOL
wintypes.LPSTR, # pcOut : LPSTR out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OLEAUT32.dll')
VarI1FromBool = Fiddle::Function.new(
lib['VarI1FromBool'],
[
Fiddle::TYPE_SHORT, # boolIn : VARIANT_BOOL
Fiddle::TYPE_VOIDP, # pcOut : LPSTR out
],
Fiddle::TYPE_INT)#[link(name = "oleaut32")]
extern "system" {
fn VarI1FromBool(
boolIn: i16, // VARIANT_BOOL
pcOut: *mut u8 // LPSTR out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OLEAUT32.dll")]
public static extern int VarI1FromBool(short boolIn, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder pcOut);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLEAUT32_VarI1FromBool' -Namespace Win32 -PassThru
# $api::VarI1FromBool(boolIn, pcOut)#uselib "OLEAUT32.dll"
#func global VarI1FromBool "VarI1FromBool" sptr, sptr
; VarI1FromBool boolIn, varptr(pcOut) ; 戻り値は stat
; boolIn : VARIANT_BOOL -> "sptr"
; pcOut : LPSTR out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "OLEAUT32.dll" #cfunc global VarI1FromBool "VarI1FromBool" int, var ; res = VarI1FromBool(boolIn, pcOut) ; boolIn : VARIANT_BOOL -> "int" ; pcOut : LPSTR out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "OLEAUT32.dll" #cfunc global VarI1FromBool "VarI1FromBool" int, sptr ; res = VarI1FromBool(boolIn, varptr(pcOut)) ; boolIn : VARIANT_BOOL -> "int" ; pcOut : LPSTR out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT VarI1FromBool(VARIANT_BOOL boolIn, LPSTR pcOut) #uselib "OLEAUT32.dll" #cfunc global VarI1FromBool "VarI1FromBool" int, var ; res = VarI1FromBool(boolIn, pcOut) ; boolIn : VARIANT_BOOL -> "int" ; pcOut : LPSTR out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT VarI1FromBool(VARIANT_BOOL boolIn, LPSTR pcOut) #uselib "OLEAUT32.dll" #cfunc global VarI1FromBool "VarI1FromBool" int, intptr ; res = VarI1FromBool(boolIn, varptr(pcOut)) ; boolIn : VARIANT_BOOL -> "int" ; pcOut : LPSTR out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
oleaut32 = windows.NewLazySystemDLL("OLEAUT32.dll")
procVarI1FromBool = oleaut32.NewProc("VarI1FromBool")
)
// boolIn (VARIANT_BOOL), pcOut (LPSTR out)
r1, _, err := procVarI1FromBool.Call(
uintptr(boolIn),
uintptr(pcOut),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction VarI1FromBool(
boolIn: Smallint; // VARIANT_BOOL
pcOut: PAnsiChar // LPSTR out
): Integer; stdcall;
external 'OLEAUT32.dll' name 'VarI1FromBool';result := DllCall("OLEAUT32\VarI1FromBool"
, "Short", boolIn ; VARIANT_BOOL
, "Ptr", pcOut ; LPSTR out
, "Int") ; return: HRESULT●VarI1FromBool(boolIn, pcOut) = DLL("OLEAUT32.dll", "int VarI1FromBool(int, char*)")
# 呼び出し: VarI1FromBool(boolIn, pcOut)
# boolIn : VARIANT_BOOL -> "int"
# pcOut : LPSTR out -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。