ホーム › Devices.AllJoyn › AllJoynConnectToBus
AllJoynConnectToBus
関数AllJoynのメッセージバスに接続する。
シグネチャ
// MSAJApi.dll
#include <windows.h>
HANDLE AllJoynConnectToBus(
LPCWSTR connectionSpec // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| connectionSpec | LPCWSTR | inoptional | 接続するAllJoynバスの接続仕様を示すUnicode文字列。 |
戻り値の型: HANDLE
各言語での呼び出し定義
// MSAJApi.dll
#include <windows.h>
HANDLE AllJoynConnectToBus(
LPCWSTR connectionSpec // optional
);[DllImport("MSAJApi.dll", SetLastError = true, ExactSpelling = true)]
static extern IntPtr AllJoynConnectToBus(
[MarshalAs(UnmanagedType.LPWStr)] string connectionSpec // LPCWSTR optional
);<DllImport("MSAJApi.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function AllJoynConnectToBus(
<MarshalAs(UnmanagedType.LPWStr)> connectionSpec As String ' LPCWSTR optional
) As IntPtr
End Function' connectionSpec : LPCWSTR optional
Declare PtrSafe Function AllJoynConnectToBus Lib "msajapi" ( _
ByVal connectionSpec As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
AllJoynConnectToBus = ctypes.windll.msajapi.AllJoynConnectToBus
AllJoynConnectToBus.restype = ctypes.c_void_p
AllJoynConnectToBus.argtypes = [
wintypes.LPCWSTR, # connectionSpec : LPCWSTR optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MSAJApi.dll')
AllJoynConnectToBus = Fiddle::Function.new(
lib['AllJoynConnectToBus'],
[
Fiddle::TYPE_VOIDP, # connectionSpec : LPCWSTR optional
],
Fiddle::TYPE_VOIDP)#[link(name = "msajapi")]
extern "system" {
fn AllJoynConnectToBus(
connectionSpec: *const u16 // LPCWSTR optional
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MSAJApi.dll", SetLastError = true)]
public static extern IntPtr AllJoynConnectToBus([MarshalAs(UnmanagedType.LPWStr)] string connectionSpec);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSAJApi_AllJoynConnectToBus' -Namespace Win32 -PassThru
# $api::AllJoynConnectToBus(connectionSpec)#uselib "MSAJApi.dll"
#func global AllJoynConnectToBus "AllJoynConnectToBus" sptr
; AllJoynConnectToBus connectionSpec ; 戻り値は stat
; connectionSpec : LPCWSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "MSAJApi.dll"
#cfunc global AllJoynConnectToBus "AllJoynConnectToBus" wstr
; res = AllJoynConnectToBus(connectionSpec)
; connectionSpec : LPCWSTR optional -> "wstr"; HANDLE AllJoynConnectToBus(LPCWSTR connectionSpec)
#uselib "MSAJApi.dll"
#cfunc global AllJoynConnectToBus "AllJoynConnectToBus" wstr
; res = AllJoynConnectToBus(connectionSpec)
; connectionSpec : LPCWSTR optional -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msajapi = windows.NewLazySystemDLL("MSAJApi.dll")
procAllJoynConnectToBus = msajapi.NewProc("AllJoynConnectToBus")
)
// connectionSpec (LPCWSTR optional)
r1, _, err := procAllJoynConnectToBus.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(connectionSpec))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HANDLEfunction AllJoynConnectToBus(
connectionSpec: PWideChar // LPCWSTR optional
): THandle; stdcall;
external 'MSAJApi.dll' name 'AllJoynConnectToBus';result := DllCall("MSAJApi\AllJoynConnectToBus"
, "WStr", connectionSpec ; LPCWSTR optional
, "Ptr") ; return: HANDLE●AllJoynConnectToBus(connectionSpec) = DLL("MSAJApi.dll", "void* AllJoynConnectToBus(char*)")
# 呼び出し: AllJoynConnectToBus(connectionSpec)
# connectionSpec : LPCWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "msajapi" fn AllJoynConnectToBus(
connectionSpec: [*c]const u16 // LPCWSTR optional
) callconv(std.os.windows.WINAPI) ?*anyopaque;proc AllJoynConnectToBus(
connectionSpec: WideCString # LPCWSTR optional
): pointer {.importc: "AllJoynConnectToBus", stdcall, dynlib: "MSAJApi.dll".}pragma(lib, "msajapi");
extern(Windows)
void* AllJoynConnectToBus(
const(wchar)* connectionSpec // LPCWSTR optional
);ccall((:AllJoynConnectToBus, "MSAJApi.dll"), stdcall, Ptr{Cvoid},
(Cwstring,),
connectionSpec)
# connectionSpec : LPCWSTR optional -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void* AllJoynConnectToBus(
const uint16_t* connectionSpec);
]]
local msajapi = ffi.load("msajapi")
-- msajapi.AllJoynConnectToBus(connectionSpec)
-- connectionSpec : LPCWSTR optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MSAJApi.dll');
const AllJoynConnectToBus = lib.func('__stdcall', 'AllJoynConnectToBus', 'void *', ['str16']);
// AllJoynConnectToBus(connectionSpec)
// connectionSpec : LPCWSTR optional -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MSAJApi.dll", {
AllJoynConnectToBus: { parameters: ["buffer"], result: "pointer" },
});
// lib.symbols.AllJoynConnectToBus(connectionSpec)
// connectionSpec : LPCWSTR optional -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void* AllJoynConnectToBus(
const uint16_t* connectionSpec);
C, "MSAJApi.dll");
// $ffi->AllJoynConnectToBus(connectionSpec);
// connectionSpec : LPCWSTR optional
// 構造体/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 Msajapi extends StdCallLibrary {
Msajapi INSTANCE = Native.load("msajapi", Msajapi.class);
Pointer AllJoynConnectToBus(
WString connectionSpec // LPCWSTR optional
);
}@[Link("msajapi")]
lib LibMSAJApi
fun AllJoynConnectToBus = AllJoynConnectToBus(
connectionSpec : UInt16* # LPCWSTR optional
) : Void*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef AllJoynConnectToBusNative = Pointer<Void> Function(Pointer<Utf16>);
typedef AllJoynConnectToBusDart = Pointer<Void> Function(Pointer<Utf16>);
final AllJoynConnectToBus = DynamicLibrary.open('MSAJApi.dll')
.lookupFunction<AllJoynConnectToBusNative, AllJoynConnectToBusDart>('AllJoynConnectToBus');
// connectionSpec : LPCWSTR optional -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function AllJoynConnectToBus(
connectionSpec: PWideChar // LPCWSTR optional
): THandle; stdcall;
external 'MSAJApi.dll' name 'AllJoynConnectToBus';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "AllJoynConnectToBus"
c_AllJoynConnectToBus :: CWString -> IO (Ptr ())
-- connectionSpec : LPCWSTR optional -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let alljoynconnecttobus =
foreign "AllJoynConnectToBus"
((ptr uint16_t) @-> returning (ptr void))
(* connectionSpec : LPCWSTR optional -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library msajapi (t "MSAJApi.dll"))
(cffi:use-foreign-library msajapi)
(cffi:defcfun ("AllJoynConnectToBus" all-joyn-connect-to-bus :convention :stdcall) :pointer
(connection-spec (:string :encoding :utf-16le))) ; LPCWSTR optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $AllJoynConnectToBus = Win32::API::More->new('MSAJApi',
'HANDLE AllJoynConnectToBus(LPCWSTR connectionSpec)');
# my $ret = $AllJoynConnectToBus->Call($connectionSpec);
# connectionSpec : LPCWSTR optional -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。