Win32 API 日本語リファレンス
ホームSecurity.Cryptography › ImportInformationCard

ImportInformationCard

関数
指定ファイルから情報カードをインポートする。
DLLinfocardapi.dll呼出規約winapi

シグネチャ

// infocardapi.dll
#include <windows.h>

HRESULT ImportInformationCard(
    LPCWSTR fileName
);

パラメーター

名前方向
fileNameLPCWSTRin

戻り値の型: HRESULT

各言語での呼び出し定義

// infocardapi.dll
#include <windows.h>

HRESULT ImportInformationCard(
    LPCWSTR fileName
);
[DllImport("infocardapi.dll", ExactSpelling = true)]
static extern int ImportInformationCard(
    [MarshalAs(UnmanagedType.LPWStr)] string fileName   // LPCWSTR
);
<DllImport("infocardapi.dll", ExactSpelling:=True)>
Public Shared Function ImportInformationCard(
    <MarshalAs(UnmanagedType.LPWStr)> fileName As String   ' LPCWSTR
) As Integer
End Function
' fileName : LPCWSTR
Declare PtrSafe Function ImportInformationCard Lib "infocardapi" ( _
    ByVal fileName As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ImportInformationCard = ctypes.windll.infocardapi.ImportInformationCard
ImportInformationCard.restype = ctypes.c_int
ImportInformationCard.argtypes = [
    wintypes.LPCWSTR,  # fileName : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('infocardapi.dll')
ImportInformationCard = Fiddle::Function.new(
  lib['ImportInformationCard'],
  [
    Fiddle::TYPE_VOIDP,  # fileName : LPCWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "infocardapi")]
extern "system" {
    fn ImportInformationCard(
        fileName: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("infocardapi.dll")]
public static extern int ImportInformationCard([MarshalAs(UnmanagedType.LPWStr)] string fileName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'infocardapi_ImportInformationCard' -Namespace Win32 -PassThru
# $api::ImportInformationCard(fileName)
#uselib "infocardapi.dll"
#func global ImportInformationCard "ImportInformationCard" sptr
; ImportInformationCard fileName   ; 戻り値は stat
; fileName : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "infocardapi.dll"
#cfunc global ImportInformationCard "ImportInformationCard" wstr
; res = ImportInformationCard(fileName)
; fileName : LPCWSTR -> "wstr"
; HRESULT ImportInformationCard(LPCWSTR fileName)
#uselib "infocardapi.dll"
#cfunc global ImportInformationCard "ImportInformationCard" wstr
; res = ImportInformationCard(fileName)
; fileName : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	infocardapi = windows.NewLazySystemDLL("infocardapi.dll")
	procImportInformationCard = infocardapi.NewProc("ImportInformationCard")
)

// fileName (LPCWSTR)
r1, _, err := procImportInformationCard.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(fileName))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function ImportInformationCard(
  fileName: PWideChar   // LPCWSTR
): Integer; stdcall;
  external 'infocardapi.dll' name 'ImportInformationCard';
result := DllCall("infocardapi\ImportInformationCard"
    , "WStr", fileName   ; LPCWSTR
    , "Int")   ; return: HRESULT
●ImportInformationCard(fileName) = DLL("infocardapi.dll", "int ImportInformationCard(char*)")
# 呼び出し: ImportInformationCard(fileName)
# fileName : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。