ホーム › Devices.WebServicesOnDevices › WSDCreateOutboundAttachment
WSDCreateOutboundAttachment
関数WSDメッセージの送信用添付オブジェクトを作成する。
シグネチャ
// wsdapi.dll
#include <windows.h>
HRESULT WSDCreateOutboundAttachment(
IWSDOutboundAttachment** ppAttachment
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| ppAttachment | IWSDOutboundAttachment** | out | 作成したIWSDOutboundAttachmentオブジェクトを受け取る出力先ポインタ。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// wsdapi.dll
#include <windows.h>
HRESULT WSDCreateOutboundAttachment(
IWSDOutboundAttachment** ppAttachment
);[DllImport("wsdapi.dll", ExactSpelling = true)]
static extern int WSDCreateOutboundAttachment(
IntPtr ppAttachment // IWSDOutboundAttachment** out
);<DllImport("wsdapi.dll", ExactSpelling:=True)>
Public Shared Function WSDCreateOutboundAttachment(
ppAttachment As IntPtr ' IWSDOutboundAttachment** out
) As Integer
End Function' ppAttachment : IWSDOutboundAttachment** out
Declare PtrSafe Function WSDCreateOutboundAttachment Lib "wsdapi" ( _
ByVal ppAttachment As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WSDCreateOutboundAttachment = ctypes.windll.wsdapi.WSDCreateOutboundAttachment
WSDCreateOutboundAttachment.restype = ctypes.c_int
WSDCreateOutboundAttachment.argtypes = [
ctypes.c_void_p, # ppAttachment : IWSDOutboundAttachment** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('wsdapi.dll')
WSDCreateOutboundAttachment = Fiddle::Function.new(
lib['WSDCreateOutboundAttachment'],
[
Fiddle::TYPE_VOIDP, # ppAttachment : IWSDOutboundAttachment** out
],
Fiddle::TYPE_INT)#[link(name = "wsdapi")]
extern "system" {
fn WSDCreateOutboundAttachment(
ppAttachment: *mut *mut core::ffi::c_void // IWSDOutboundAttachment** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("wsdapi.dll")]
public static extern int WSDCreateOutboundAttachment(IntPtr ppAttachment);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wsdapi_WSDCreateOutboundAttachment' -Namespace Win32 -PassThru
# $api::WSDCreateOutboundAttachment(ppAttachment)#uselib "wsdapi.dll"
#func global WSDCreateOutboundAttachment "WSDCreateOutboundAttachment" sptr
; WSDCreateOutboundAttachment ppAttachment ; 戻り値は stat
; ppAttachment : IWSDOutboundAttachment** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "wsdapi.dll"
#cfunc global WSDCreateOutboundAttachment "WSDCreateOutboundAttachment" sptr
; res = WSDCreateOutboundAttachment(ppAttachment)
; ppAttachment : IWSDOutboundAttachment** out -> "sptr"; HRESULT WSDCreateOutboundAttachment(IWSDOutboundAttachment** ppAttachment)
#uselib "wsdapi.dll"
#cfunc global WSDCreateOutboundAttachment "WSDCreateOutboundAttachment" intptr
; res = WSDCreateOutboundAttachment(ppAttachment)
; ppAttachment : IWSDOutboundAttachment** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wsdapi = windows.NewLazySystemDLL("wsdapi.dll")
procWSDCreateOutboundAttachment = wsdapi.NewProc("WSDCreateOutboundAttachment")
)
// ppAttachment (IWSDOutboundAttachment** out)
r1, _, err := procWSDCreateOutboundAttachment.Call(
uintptr(ppAttachment),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WSDCreateOutboundAttachment(
ppAttachment: Pointer // IWSDOutboundAttachment** out
): Integer; stdcall;
external 'wsdapi.dll' name 'WSDCreateOutboundAttachment';result := DllCall("wsdapi\WSDCreateOutboundAttachment"
, "Ptr", ppAttachment ; IWSDOutboundAttachment** out
, "Int") ; return: HRESULT●WSDCreateOutboundAttachment(ppAttachment) = DLL("wsdapi.dll", "int WSDCreateOutboundAttachment(void*)")
# 呼び出し: WSDCreateOutboundAttachment(ppAttachment)
# ppAttachment : IWSDOutboundAttachment** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "wsdapi" fn WSDCreateOutboundAttachment(
ppAttachment: ?*anyopaque // IWSDOutboundAttachment** out
) callconv(std.os.windows.WINAPI) i32;proc WSDCreateOutboundAttachment(
ppAttachment: pointer # IWSDOutboundAttachment** out
): int32 {.importc: "WSDCreateOutboundAttachment", stdcall, dynlib: "wsdapi.dll".}pragma(lib, "wsdapi");
extern(Windows)
int WSDCreateOutboundAttachment(
void* ppAttachment // IWSDOutboundAttachment** out
);ccall((:WSDCreateOutboundAttachment, "wsdapi.dll"), stdcall, Int32,
(Ptr{Cvoid},),
ppAttachment)
# ppAttachment : IWSDOutboundAttachment** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t WSDCreateOutboundAttachment(
void* ppAttachment);
]]
local wsdapi = ffi.load("wsdapi")
-- wsdapi.WSDCreateOutboundAttachment(ppAttachment)
-- ppAttachment : IWSDOutboundAttachment** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('wsdapi.dll');
const WSDCreateOutboundAttachment = lib.func('__stdcall', 'WSDCreateOutboundAttachment', 'int32_t', ['void *']);
// WSDCreateOutboundAttachment(ppAttachment)
// ppAttachment : IWSDOutboundAttachment** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("wsdapi.dll", {
WSDCreateOutboundAttachment: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.WSDCreateOutboundAttachment(ppAttachment)
// ppAttachment : IWSDOutboundAttachment** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t WSDCreateOutboundAttachment(
void* ppAttachment);
C, "wsdapi.dll");
// $ffi->WSDCreateOutboundAttachment(ppAttachment);
// ppAttachment : IWSDOutboundAttachment** out
// 構造体/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 Wsdapi extends StdCallLibrary {
Wsdapi INSTANCE = Native.load("wsdapi", Wsdapi.class);
int WSDCreateOutboundAttachment(
Pointer ppAttachment // IWSDOutboundAttachment** out
);
}@[Link("wsdapi")]
lib Libwsdapi
fun WSDCreateOutboundAttachment = WSDCreateOutboundAttachment(
ppAttachment : Void* # IWSDOutboundAttachment** out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef WSDCreateOutboundAttachmentNative = Int32 Function(Pointer<Void>);
typedef WSDCreateOutboundAttachmentDart = int Function(Pointer<Void>);
final WSDCreateOutboundAttachment = DynamicLibrary.open('wsdapi.dll')
.lookupFunction<WSDCreateOutboundAttachmentNative, WSDCreateOutboundAttachmentDart>('WSDCreateOutboundAttachment');
// ppAttachment : IWSDOutboundAttachment** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function WSDCreateOutboundAttachment(
ppAttachment: Pointer // IWSDOutboundAttachment** out
): Integer; stdcall;
external 'wsdapi.dll' name 'WSDCreateOutboundAttachment';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "WSDCreateOutboundAttachment"
c_WSDCreateOutboundAttachment :: Ptr () -> IO Int32
-- ppAttachment : IWSDOutboundAttachment** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let wsdcreateoutboundattachment =
foreign "WSDCreateOutboundAttachment"
((ptr void) @-> returning int32_t)
(* ppAttachment : IWSDOutboundAttachment** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library wsdapi (t "wsdapi.dll"))
(cffi:use-foreign-library wsdapi)
(cffi:defcfun ("WSDCreateOutboundAttachment" wsdcreate-outbound-attachment :convention :stdcall) :int32
(pp-attachment :pointer)) ; IWSDOutboundAttachment** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $WSDCreateOutboundAttachment = Win32::API::More->new('wsdapi',
'int WSDCreateOutboundAttachment(LPVOID ppAttachment)');
# my $ret = $WSDCreateOutboundAttachment->Call($ppAttachment);
# ppAttachment : IWSDOutboundAttachment** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。