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

alljoyn_abouticon_setcontent

関数
AboutIconにMIMEタイプ付きのアイコン画像データを設定する。
DLLMSAJApi.dll呼出規約winapi

シグネチャ

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

QStatus alljoyn_abouticon_setcontent(
    alljoyn_abouticon icon,
    LPCSTR type,
    BYTE* data,
    UINT_PTR csize,
    BYTE ownsData
);

パラメーター

名前方向
iconalljoyn_abouticonin
typeLPCSTRin
dataBYTE*inout
csizeUINT_PTRin
ownsDataBYTEin

戻り値の型: QStatus

各言語での呼び出し定義

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

QStatus alljoyn_abouticon_setcontent(
    alljoyn_abouticon icon,
    LPCSTR type,
    BYTE* data,
    UINT_PTR csize,
    BYTE ownsData
);
[DllImport("MSAJApi.dll", ExactSpelling = true)]
static extern int alljoyn_abouticon_setcontent(
    IntPtr icon,   // alljoyn_abouticon
    [MarshalAs(UnmanagedType.LPStr)] string type,   // LPCSTR
    IntPtr data,   // BYTE* in/out
    UIntPtr csize,   // UINT_PTR
    byte ownsData   // BYTE
);
<DllImport("MSAJApi.dll", ExactSpelling:=True)>
Public Shared Function alljoyn_abouticon_setcontent(
    icon As IntPtr,   ' alljoyn_abouticon
    <MarshalAs(UnmanagedType.LPStr)> type As String,   ' LPCSTR
    data As IntPtr,   ' BYTE* in/out
    csize As UIntPtr,   ' UINT_PTR
    ownsData As Byte   ' BYTE
) As Integer
End Function
' icon : alljoyn_abouticon
' type : LPCSTR
' data : BYTE* in/out
' csize : UINT_PTR
' ownsData : BYTE
Declare PtrSafe Function alljoyn_abouticon_setcontent Lib "msajapi" ( _
    ByVal icon As LongPtr, _
    ByVal type As String, _
    ByVal data As LongPtr, _
    ByVal csize As LongPtr, _
    ByVal ownsData As Byte) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

alljoyn_abouticon_setcontent = ctypes.windll.msajapi.alljoyn_abouticon_setcontent
alljoyn_abouticon_setcontent.restype = ctypes.c_int
alljoyn_abouticon_setcontent.argtypes = [
    ctypes.c_ssize_t,  # icon : alljoyn_abouticon
    wintypes.LPCSTR,  # type : LPCSTR
    ctypes.POINTER(ctypes.c_ubyte),  # data : BYTE* in/out
    ctypes.c_size_t,  # csize : UINT_PTR
    ctypes.c_ubyte,  # ownsData : BYTE
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MSAJApi.dll')
alljoyn_abouticon_setcontent = Fiddle::Function.new(
  lib['alljoyn_abouticon_setcontent'],
  [
    Fiddle::TYPE_INTPTR_T,  # icon : alljoyn_abouticon
    Fiddle::TYPE_VOIDP,  # type : LPCSTR
    Fiddle::TYPE_VOIDP,  # data : BYTE* in/out
    Fiddle::TYPE_UINTPTR_T,  # csize : UINT_PTR
    -Fiddle::TYPE_CHAR,  # ownsData : BYTE
  ],
  Fiddle::TYPE_INT)
#[link(name = "msajapi")]
extern "system" {
    fn alljoyn_abouticon_setcontent(
        icon: isize,  // alljoyn_abouticon
        type: *const u8,  // LPCSTR
        data: *mut u8,  // BYTE* in/out
        csize: usize,  // UINT_PTR
        ownsData: u8  // BYTE
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MSAJApi.dll")]
public static extern int alljoyn_abouticon_setcontent(IntPtr icon, [MarshalAs(UnmanagedType.LPStr)] string type, IntPtr data, UIntPtr csize, byte ownsData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSAJApi_alljoyn_abouticon_setcontent' -Namespace Win32 -PassThru
# $api::alljoyn_abouticon_setcontent(icon, type, data, csize, ownsData)
#uselib "MSAJApi.dll"
#func global alljoyn_abouticon_setcontent "alljoyn_abouticon_setcontent" sptr, sptr, sptr, sptr, sptr
; alljoyn_abouticon_setcontent icon, type, varptr(data), csize, ownsData   ; 戻り値は stat
; icon : alljoyn_abouticon -> "sptr"
; type : LPCSTR -> "sptr"
; data : BYTE* in/out -> "sptr"
; csize : UINT_PTR -> "sptr"
; ownsData : BYTE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MSAJApi.dll"
#cfunc global alljoyn_abouticon_setcontent "alljoyn_abouticon_setcontent" sptr, str, var, sptr, int
; res = alljoyn_abouticon_setcontent(icon, type, data, csize, ownsData)
; icon : alljoyn_abouticon -> "sptr"
; type : LPCSTR -> "str"
; data : BYTE* in/out -> "var"
; csize : UINT_PTR -> "sptr"
; ownsData : BYTE -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; QStatus alljoyn_abouticon_setcontent(alljoyn_abouticon icon, LPCSTR type, BYTE* data, UINT_PTR csize, BYTE ownsData)
#uselib "MSAJApi.dll"
#cfunc global alljoyn_abouticon_setcontent "alljoyn_abouticon_setcontent" intptr, str, var, intptr, int
; res = alljoyn_abouticon_setcontent(icon, type, data, csize, ownsData)
; icon : alljoyn_abouticon -> "intptr"
; type : LPCSTR -> "str"
; data : BYTE* in/out -> "var"
; csize : UINT_PTR -> "intptr"
; ownsData : BYTE -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msajapi = windows.NewLazySystemDLL("MSAJApi.dll")
	procalljoyn_abouticon_setcontent = msajapi.NewProc("alljoyn_abouticon_setcontent")
)

// icon (alljoyn_abouticon), type (LPCSTR), data (BYTE* in/out), csize (UINT_PTR), ownsData (BYTE)
r1, _, err := procalljoyn_abouticon_setcontent.Call(
	uintptr(icon),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(type))),
	uintptr(data),
	uintptr(csize),
	uintptr(ownsData),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // QStatus
function alljoyn_abouticon_setcontent(
  icon: NativeInt;   // alljoyn_abouticon
  type: PAnsiChar;   // LPCSTR
  data: Pointer;   // BYTE* in/out
  csize: NativeUInt;   // UINT_PTR
  ownsData: Byte   // BYTE
): Integer; stdcall;
  external 'MSAJApi.dll' name 'alljoyn_abouticon_setcontent';
result := DllCall("MSAJApi\alljoyn_abouticon_setcontent"
    , "Ptr", icon   ; alljoyn_abouticon
    , "AStr", type   ; LPCSTR
    , "Ptr", data   ; BYTE* in/out
    , "UPtr", csize   ; UINT_PTR
    , "UChar", ownsData   ; BYTE
    , "Int")   ; return: QStatus
●alljoyn_abouticon_setcontent(icon, type, data, csize, ownsData) = DLL("MSAJApi.dll", "int alljoyn_abouticon_setcontent(int, char*, void*, int, byte)")
# 呼び出し: alljoyn_abouticon_setcontent(icon, type, data, csize, ownsData)
# icon : alljoyn_abouticon -> "int"
# type : LPCSTR -> "char*"
# data : BYTE* in/out -> "void*"
# csize : UINT_PTR -> "int"
# ownsData : BYTE -> "byte"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。