ホーム › Web.InternetExplorer › IESaveFile
IESaveFile
関数IE保護モードでファイルを保存する。
シグネチャ
// Ieframe.dll
#include <windows.h>
HRESULT IESaveFile(
HANDLE hState,
LPCWSTR lpwstrSourceFile
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hState | HANDLE | in | 保存操作の状態を表すハンドル。IEShowSaveFileDialogで取得したもの。 |
| lpwstrSourceFile | LPCWSTR | in | 保存元となるソースファイルのパス。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// Ieframe.dll
#include <windows.h>
HRESULT IESaveFile(
HANDLE hState,
LPCWSTR lpwstrSourceFile
);[DllImport("Ieframe.dll", ExactSpelling = true)]
static extern int IESaveFile(
IntPtr hState, // HANDLE
[MarshalAs(UnmanagedType.LPWStr)] string lpwstrSourceFile // LPCWSTR
);<DllImport("Ieframe.dll", ExactSpelling:=True)>
Public Shared Function IESaveFile(
hState As IntPtr, ' HANDLE
<MarshalAs(UnmanagedType.LPWStr)> lpwstrSourceFile As String ' LPCWSTR
) As Integer
End Function' hState : HANDLE
' lpwstrSourceFile : LPCWSTR
Declare PtrSafe Function IESaveFile Lib "ieframe" ( _
ByVal hState As LongPtr, _
ByVal lpwstrSourceFile As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
IESaveFile = ctypes.windll.ieframe.IESaveFile
IESaveFile.restype = ctypes.c_int
IESaveFile.argtypes = [
wintypes.HANDLE, # hState : HANDLE
wintypes.LPCWSTR, # lpwstrSourceFile : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('Ieframe.dll')
IESaveFile = Fiddle::Function.new(
lib['IESaveFile'],
[
Fiddle::TYPE_VOIDP, # hState : HANDLE
Fiddle::TYPE_VOIDP, # lpwstrSourceFile : LPCWSTR
],
Fiddle::TYPE_INT)#[link(name = "ieframe")]
extern "system" {
fn IESaveFile(
hState: *mut core::ffi::c_void, // HANDLE
lpwstrSourceFile: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("Ieframe.dll")]
public static extern int IESaveFile(IntPtr hState, [MarshalAs(UnmanagedType.LPWStr)] string lpwstrSourceFile);
"@
$api = Add-Type -MemberDefinition $sig -Name 'Ieframe_IESaveFile' -Namespace Win32 -PassThru
# $api::IESaveFile(hState, lpwstrSourceFile)#uselib "Ieframe.dll"
#func global IESaveFile "IESaveFile" sptr, sptr
; IESaveFile hState, lpwstrSourceFile ; 戻り値は stat
; hState : HANDLE -> "sptr"
; lpwstrSourceFile : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "Ieframe.dll"
#cfunc global IESaveFile "IESaveFile" sptr, wstr
; res = IESaveFile(hState, lpwstrSourceFile)
; hState : HANDLE -> "sptr"
; lpwstrSourceFile : LPCWSTR -> "wstr"; HRESULT IESaveFile(HANDLE hState, LPCWSTR lpwstrSourceFile)
#uselib "Ieframe.dll"
#cfunc global IESaveFile "IESaveFile" intptr, wstr
; res = IESaveFile(hState, lpwstrSourceFile)
; hState : HANDLE -> "intptr"
; lpwstrSourceFile : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ieframe = windows.NewLazySystemDLL("Ieframe.dll")
procIESaveFile = ieframe.NewProc("IESaveFile")
)
// hState (HANDLE), lpwstrSourceFile (LPCWSTR)
r1, _, err := procIESaveFile.Call(
uintptr(hState),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpwstrSourceFile))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction IESaveFile(
hState: THandle; // HANDLE
lpwstrSourceFile: PWideChar // LPCWSTR
): Integer; stdcall;
external 'Ieframe.dll' name 'IESaveFile';result := DllCall("Ieframe\IESaveFile"
, "Ptr", hState ; HANDLE
, "WStr", lpwstrSourceFile ; LPCWSTR
, "Int") ; return: HRESULT●IESaveFile(hState, lpwstrSourceFile) = DLL("Ieframe.dll", "int IESaveFile(void*, char*)")
# 呼び出し: IESaveFile(hState, lpwstrSourceFile)
# hState : HANDLE -> "void*"
# lpwstrSourceFile : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "ieframe" fn IESaveFile(
hState: ?*anyopaque, // HANDLE
lpwstrSourceFile: [*c]const u16 // LPCWSTR
) callconv(std.os.windows.WINAPI) i32;proc IESaveFile(
hState: pointer, # HANDLE
lpwstrSourceFile: WideCString # LPCWSTR
): int32 {.importc: "IESaveFile", stdcall, dynlib: "Ieframe.dll".}pragma(lib, "ieframe");
extern(Windows)
int IESaveFile(
void* hState, // HANDLE
const(wchar)* lpwstrSourceFile // LPCWSTR
);ccall((:IESaveFile, "Ieframe.dll"), stdcall, Int32,
(Ptr{Cvoid}, Cwstring),
hState, lpwstrSourceFile)
# hState : HANDLE -> Ptr{Cvoid}
# lpwstrSourceFile : LPCWSTR -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t IESaveFile(
void* hState,
const uint16_t* lpwstrSourceFile);
]]
local ieframe = ffi.load("ieframe")
-- ieframe.IESaveFile(hState, lpwstrSourceFile)
-- hState : HANDLE
-- lpwstrSourceFile : LPCWSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('Ieframe.dll');
const IESaveFile = lib.func('__stdcall', 'IESaveFile', 'int32_t', ['void *', 'str16']);
// IESaveFile(hState, lpwstrSourceFile)
// hState : HANDLE -> 'void *'
// lpwstrSourceFile : LPCWSTR -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("Ieframe.dll", {
IESaveFile: { parameters: ["pointer", "buffer"], result: "i32" },
});
// lib.symbols.IESaveFile(hState, lpwstrSourceFile)
// hState : HANDLE -> "pointer"
// lpwstrSourceFile : LPCWSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t IESaveFile(
void* hState,
const uint16_t* lpwstrSourceFile);
C, "Ieframe.dll");
// $ffi->IESaveFile(hState, lpwstrSourceFile);
// hState : HANDLE
// lpwstrSourceFile : LPCWSTR
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Ieframe extends StdCallLibrary {
Ieframe INSTANCE = Native.load("ieframe", Ieframe.class);
int IESaveFile(
Pointer hState, // HANDLE
WString lpwstrSourceFile // LPCWSTR
);
}@[Link("ieframe")]
lib LibIeframe
fun IESaveFile = IESaveFile(
hState : Void*, # HANDLE
lpwstrSourceFile : UInt16* # LPCWSTR
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef IESaveFileNative = Int32 Function(Pointer<Void>, Pointer<Utf16>);
typedef IESaveFileDart = int Function(Pointer<Void>, Pointer<Utf16>);
final IESaveFile = DynamicLibrary.open('Ieframe.dll')
.lookupFunction<IESaveFileNative, IESaveFileDart>('IESaveFile');
// hState : HANDLE -> Pointer<Void>
// lpwstrSourceFile : LPCWSTR -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function IESaveFile(
hState: THandle; // HANDLE
lpwstrSourceFile: PWideChar // LPCWSTR
): Integer; stdcall;
external 'Ieframe.dll' name 'IESaveFile';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "IESaveFile"
c_IESaveFile :: Ptr () -> CWString -> IO Int32
-- hState : HANDLE -> Ptr ()
-- lpwstrSourceFile : LPCWSTR -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let iesavefile =
foreign "IESaveFile"
((ptr void) @-> (ptr uint16_t) @-> returning int32_t)
(* hState : HANDLE -> (ptr void) *)
(* lpwstrSourceFile : LPCWSTR -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library ieframe (t "Ieframe.dll"))
(cffi:use-foreign-library ieframe)
(cffi:defcfun ("IESaveFile" iesave-file :convention :stdcall) :int32
(h-state :pointer) ; HANDLE
(lpwstr-source-file (:string :encoding :utf-16le))) ; LPCWSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $IESaveFile = Win32::API::More->new('Ieframe',
'int IESaveFile(HANDLE hState, LPCWSTR lpwstrSourceFile)');
# my $ret = $IESaveFile->Call($hState, $lpwstrSourceFile);
# hState : HANDLE -> HANDLE
# lpwstrSourceFile : LPCWSTR -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。