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