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