Win32 API 日本語リファレンス
ホームSystem.MessageQueuing › MQGetQueueProperties

MQGetQueueProperties

関数
指定キューのプロパティを取得する。
DLLmqrt.dll呼出規約winapi

シグネチャ

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

HRESULT MQGetQueueProperties(
    LPCWSTR lpwcsFormatName,
    MQQUEUEPROPS* pQueueProps
);

パラメーター

名前方向
lpwcsFormatNameLPCWSTRin
pQueuePropsMQQUEUEPROPS*inout

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT MQGetQueueProperties(
    LPCWSTR lpwcsFormatName,
    MQQUEUEPROPS* pQueueProps
);
[DllImport("mqrt.dll", ExactSpelling = true)]
static extern int MQGetQueueProperties(
    [MarshalAs(UnmanagedType.LPWStr)] string lpwcsFormatName,   // LPCWSTR
    IntPtr pQueueProps   // MQQUEUEPROPS* in/out
);
<DllImport("mqrt.dll", ExactSpelling:=True)>
Public Shared Function MQGetQueueProperties(
    <MarshalAs(UnmanagedType.LPWStr)> lpwcsFormatName As String,   ' LPCWSTR
    pQueueProps As IntPtr   ' MQQUEUEPROPS* in/out
) As Integer
End Function
' lpwcsFormatName : LPCWSTR
' pQueueProps : MQQUEUEPROPS* in/out
Declare PtrSafe Function MQGetQueueProperties Lib "mqrt" ( _
    ByVal lpwcsFormatName As LongPtr, _
    ByVal pQueueProps As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MQGetQueueProperties = ctypes.windll.mqrt.MQGetQueueProperties
MQGetQueueProperties.restype = ctypes.c_int
MQGetQueueProperties.argtypes = [
    wintypes.LPCWSTR,  # lpwcsFormatName : LPCWSTR
    ctypes.c_void_p,  # pQueueProps : MQQUEUEPROPS* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('mqrt.dll')
MQGetQueueProperties = Fiddle::Function.new(
  lib['MQGetQueueProperties'],
  [
    Fiddle::TYPE_VOIDP,  # lpwcsFormatName : LPCWSTR
    Fiddle::TYPE_VOIDP,  # pQueueProps : MQQUEUEPROPS* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mqrt")]
extern "system" {
    fn MQGetQueueProperties(
        lpwcsFormatName: *const u16,  // LPCWSTR
        pQueueProps: *mut MQQUEUEPROPS  // MQQUEUEPROPS* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("mqrt.dll")]
public static extern int MQGetQueueProperties([MarshalAs(UnmanagedType.LPWStr)] string lpwcsFormatName, IntPtr pQueueProps);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mqrt_MQGetQueueProperties' -Namespace Win32 -PassThru
# $api::MQGetQueueProperties(lpwcsFormatName, pQueueProps)
#uselib "mqrt.dll"
#func global MQGetQueueProperties "MQGetQueueProperties" sptr, sptr
; MQGetQueueProperties lpwcsFormatName, varptr(pQueueProps)   ; 戻り値は stat
; lpwcsFormatName : LPCWSTR -> "sptr"
; pQueueProps : MQQUEUEPROPS* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "mqrt.dll"
#cfunc global MQGetQueueProperties "MQGetQueueProperties" wstr, var
; res = MQGetQueueProperties(lpwcsFormatName, pQueueProps)
; lpwcsFormatName : LPCWSTR -> "wstr"
; pQueueProps : MQQUEUEPROPS* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT MQGetQueueProperties(LPCWSTR lpwcsFormatName, MQQUEUEPROPS* pQueueProps)
#uselib "mqrt.dll"
#cfunc global MQGetQueueProperties "MQGetQueueProperties" wstr, var
; res = MQGetQueueProperties(lpwcsFormatName, pQueueProps)
; lpwcsFormatName : LPCWSTR -> "wstr"
; pQueueProps : MQQUEUEPROPS* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mqrt = windows.NewLazySystemDLL("mqrt.dll")
	procMQGetQueueProperties = mqrt.NewProc("MQGetQueueProperties")
)

// lpwcsFormatName (LPCWSTR), pQueueProps (MQQUEUEPROPS* in/out)
r1, _, err := procMQGetQueueProperties.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpwcsFormatName))),
	uintptr(pQueueProps),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function MQGetQueueProperties(
  lpwcsFormatName: PWideChar;   // LPCWSTR
  pQueueProps: Pointer   // MQQUEUEPROPS* in/out
): Integer; stdcall;
  external 'mqrt.dll' name 'MQGetQueueProperties';
result := DllCall("mqrt\MQGetQueueProperties"
    , "WStr", lpwcsFormatName   ; LPCWSTR
    , "Ptr", pQueueProps   ; MQQUEUEPROPS* in/out
    , "Int")   ; return: HRESULT
●MQGetQueueProperties(lpwcsFormatName, pQueueProps) = DLL("mqrt.dll", "int MQGetQueueProperties(char*, void*)")
# 呼び出し: MQGetQueueProperties(lpwcsFormatName, pQueueProps)
# lpwcsFormatName : LPCWSTR -> "char*"
# pQueueProps : MQQUEUEPROPS* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。