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