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