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