ホーム › System.Com.StructuredStorage › StgGetIFillLockBytesOnFile
StgGetIFillLockBytesOnFile
関数指定ファイルを基にIFillLockBytesインターフェイスを取得する。
シグネチャ
// ole32.dll
#include <windows.h>
HRESULT StgGetIFillLockBytesOnFile(
LPCWSTR pwcsName,
IFillLockBytes** ppflb
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pwcsName | LPCWSTR | in |
| ppflb | IFillLockBytes** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// ole32.dll
#include <windows.h>
HRESULT StgGetIFillLockBytesOnFile(
LPCWSTR pwcsName,
IFillLockBytes** ppflb
);[DllImport("ole32.dll", ExactSpelling = true)]
static extern int StgGetIFillLockBytesOnFile(
[MarshalAs(UnmanagedType.LPWStr)] string pwcsName, // LPCWSTR
IntPtr ppflb // IFillLockBytes** out
);<DllImport("ole32.dll", ExactSpelling:=True)>
Public Shared Function StgGetIFillLockBytesOnFile(
<MarshalAs(UnmanagedType.LPWStr)> pwcsName As String, ' LPCWSTR
ppflb As IntPtr ' IFillLockBytes** out
) As Integer
End Function' pwcsName : LPCWSTR
' ppflb : IFillLockBytes** out
Declare PtrSafe Function StgGetIFillLockBytesOnFile Lib "ole32" ( _
ByVal pwcsName As LongPtr, _
ByVal ppflb As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
StgGetIFillLockBytesOnFile = ctypes.windll.ole32.StgGetIFillLockBytesOnFile
StgGetIFillLockBytesOnFile.restype = ctypes.c_int
StgGetIFillLockBytesOnFile.argtypes = [
wintypes.LPCWSTR, # pwcsName : LPCWSTR
ctypes.c_void_p, # ppflb : IFillLockBytes** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ole32.dll')
StgGetIFillLockBytesOnFile = Fiddle::Function.new(
lib['StgGetIFillLockBytesOnFile'],
[
Fiddle::TYPE_VOIDP, # pwcsName : LPCWSTR
Fiddle::TYPE_VOIDP, # ppflb : IFillLockBytes** out
],
Fiddle::TYPE_INT)#[link(name = "ole32")]
extern "system" {
fn StgGetIFillLockBytesOnFile(
pwcsName: *const u16, // LPCWSTR
ppflb: *mut *mut core::ffi::c_void // IFillLockBytes** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ole32.dll")]
public static extern int StgGetIFillLockBytesOnFile([MarshalAs(UnmanagedType.LPWStr)] string pwcsName, IntPtr ppflb);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ole32_StgGetIFillLockBytesOnFile' -Namespace Win32 -PassThru
# $api::StgGetIFillLockBytesOnFile(pwcsName, ppflb)#uselib "ole32.dll"
#func global StgGetIFillLockBytesOnFile "StgGetIFillLockBytesOnFile" sptr, sptr
; StgGetIFillLockBytesOnFile pwcsName, ppflb ; 戻り値は stat
; pwcsName : LPCWSTR -> "sptr"
; ppflb : IFillLockBytes** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ole32.dll"
#cfunc global StgGetIFillLockBytesOnFile "StgGetIFillLockBytesOnFile" wstr, sptr
; res = StgGetIFillLockBytesOnFile(pwcsName, ppflb)
; pwcsName : LPCWSTR -> "wstr"
; ppflb : IFillLockBytes** out -> "sptr"; HRESULT StgGetIFillLockBytesOnFile(LPCWSTR pwcsName, IFillLockBytes** ppflb)
#uselib "ole32.dll"
#cfunc global StgGetIFillLockBytesOnFile "StgGetIFillLockBytesOnFile" wstr, intptr
; res = StgGetIFillLockBytesOnFile(pwcsName, ppflb)
; pwcsName : LPCWSTR -> "wstr"
; ppflb : IFillLockBytes** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ole32 = windows.NewLazySystemDLL("ole32.dll")
procStgGetIFillLockBytesOnFile = ole32.NewProc("StgGetIFillLockBytesOnFile")
)
// pwcsName (LPCWSTR), ppflb (IFillLockBytes** out)
r1, _, err := procStgGetIFillLockBytesOnFile.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwcsName))),
uintptr(ppflb),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction StgGetIFillLockBytesOnFile(
pwcsName: PWideChar; // LPCWSTR
ppflb: Pointer // IFillLockBytes** out
): Integer; stdcall;
external 'ole32.dll' name 'StgGetIFillLockBytesOnFile';result := DllCall("ole32\StgGetIFillLockBytesOnFile"
, "WStr", pwcsName ; LPCWSTR
, "Ptr", ppflb ; IFillLockBytes** out
, "Int") ; return: HRESULT●StgGetIFillLockBytesOnFile(pwcsName, ppflb) = DLL("ole32.dll", "int StgGetIFillLockBytesOnFile(char*, void*)")
# 呼び出し: StgGetIFillLockBytesOnFile(pwcsName, ppflb)
# pwcsName : LPCWSTR -> "char*"
# ppflb : IFillLockBytes** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。