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