Win32 API 日本語リファレンス
ホームDevices.AllJoyn › alljoyn_busattachment_requestname

alljoyn_busattachment_requestname

関数
指定したウェルノウン名の所有権を要求する。
DLLMSAJApi.dll呼出規約winapi

シグネチャ

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

QStatus alljoyn_busattachment_requestname(
    alljoyn_busattachment bus,
    LPCSTR requestedName,
    DWORD flags
);

パラメーター

名前方向
busalljoyn_busattachmentin
requestedNameLPCSTRin
flagsDWORDin

戻り値の型: QStatus

各言語での呼び出し定義

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

QStatus alljoyn_busattachment_requestname(
    alljoyn_busattachment bus,
    LPCSTR requestedName,
    DWORD flags
);
[DllImport("MSAJApi.dll", ExactSpelling = true)]
static extern int alljoyn_busattachment_requestname(
    IntPtr bus,   // alljoyn_busattachment
    [MarshalAs(UnmanagedType.LPStr)] string requestedName,   // LPCSTR
    uint flags   // DWORD
);
<DllImport("MSAJApi.dll", ExactSpelling:=True)>
Public Shared Function alljoyn_busattachment_requestname(
    bus As IntPtr,   ' alljoyn_busattachment
    <MarshalAs(UnmanagedType.LPStr)> requestedName As String,   ' LPCSTR
    flags As UInteger   ' DWORD
) As Integer
End Function
' bus : alljoyn_busattachment
' requestedName : LPCSTR
' flags : DWORD
Declare PtrSafe Function alljoyn_busattachment_requestname Lib "msajapi" ( _
    ByVal bus As LongPtr, _
    ByVal requestedName As String, _
    ByVal flags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

alljoyn_busattachment_requestname = ctypes.windll.msajapi.alljoyn_busattachment_requestname
alljoyn_busattachment_requestname.restype = ctypes.c_int
alljoyn_busattachment_requestname.argtypes = [
    ctypes.c_ssize_t,  # bus : alljoyn_busattachment
    wintypes.LPCSTR,  # requestedName : LPCSTR
    wintypes.DWORD,  # flags : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MSAJApi.dll')
alljoyn_busattachment_requestname = Fiddle::Function.new(
  lib['alljoyn_busattachment_requestname'],
  [
    Fiddle::TYPE_INTPTR_T,  # bus : alljoyn_busattachment
    Fiddle::TYPE_VOIDP,  # requestedName : LPCSTR
    -Fiddle::TYPE_INT,  # flags : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "msajapi")]
extern "system" {
    fn alljoyn_busattachment_requestname(
        bus: isize,  // alljoyn_busattachment
        requestedName: *const u8,  // LPCSTR
        flags: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MSAJApi.dll")]
public static extern int alljoyn_busattachment_requestname(IntPtr bus, [MarshalAs(UnmanagedType.LPStr)] string requestedName, uint flags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSAJApi_alljoyn_busattachment_requestname' -Namespace Win32 -PassThru
# $api::alljoyn_busattachment_requestname(bus, requestedName, flags)
#uselib "MSAJApi.dll"
#func global alljoyn_busattachment_requestname "alljoyn_busattachment_requestname" sptr, sptr, sptr
; alljoyn_busattachment_requestname bus, requestedName, flags   ; 戻り値は stat
; bus : alljoyn_busattachment -> "sptr"
; requestedName : LPCSTR -> "sptr"
; flags : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MSAJApi.dll"
#cfunc global alljoyn_busattachment_requestname "alljoyn_busattachment_requestname" sptr, str, int
; res = alljoyn_busattachment_requestname(bus, requestedName, flags)
; bus : alljoyn_busattachment -> "sptr"
; requestedName : LPCSTR -> "str"
; flags : DWORD -> "int"
; QStatus alljoyn_busattachment_requestname(alljoyn_busattachment bus, LPCSTR requestedName, DWORD flags)
#uselib "MSAJApi.dll"
#cfunc global alljoyn_busattachment_requestname "alljoyn_busattachment_requestname" intptr, str, int
; res = alljoyn_busattachment_requestname(bus, requestedName, flags)
; bus : alljoyn_busattachment -> "intptr"
; requestedName : LPCSTR -> "str"
; flags : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msajapi = windows.NewLazySystemDLL("MSAJApi.dll")
	procalljoyn_busattachment_requestname = msajapi.NewProc("alljoyn_busattachment_requestname")
)

// bus (alljoyn_busattachment), requestedName (LPCSTR), flags (DWORD)
r1, _, err := procalljoyn_busattachment_requestname.Call(
	uintptr(bus),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(requestedName))),
	uintptr(flags),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // QStatus
function alljoyn_busattachment_requestname(
  bus: NativeInt;   // alljoyn_busattachment
  requestedName: PAnsiChar;   // LPCSTR
  flags: DWORD   // DWORD
): Integer; stdcall;
  external 'MSAJApi.dll' name 'alljoyn_busattachment_requestname';
result := DllCall("MSAJApi\alljoyn_busattachment_requestname"
    , "Ptr", bus   ; alljoyn_busattachment
    , "AStr", requestedName   ; LPCSTR
    , "UInt", flags   ; DWORD
    , "Int")   ; return: QStatus
●alljoyn_busattachment_requestname(bus, requestedName, flags) = DLL("MSAJApi.dll", "int alljoyn_busattachment_requestname(int, char*, dword)")
# 呼び出し: alljoyn_busattachment_requestname(bus, requestedName, flags)
# bus : alljoyn_busattachment -> "int"
# requestedName : LPCSTR -> "char*"
# flags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。