ホーム › System.MessageQueuing › MQGetPrivateComputerInformation
MQGetPrivateComputerInformation
関数コンピュータのプライベートMSMQ情報を取得する。
シグネチャ
// mqrt.dll
#include <windows.h>
HRESULT MQGetPrivateComputerInformation(
LPCWSTR lpwcsComputerName, // optional
MQPRIVATEPROPS* pPrivateProps
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpwcsComputerName | LPCWSTR | inoptional |
| pPrivateProps | MQPRIVATEPROPS* | inout |
戻り値の型: HRESULT
各言語での呼び出し定義
// mqrt.dll
#include <windows.h>
HRESULT MQGetPrivateComputerInformation(
LPCWSTR lpwcsComputerName, // optional
MQPRIVATEPROPS* pPrivateProps
);[DllImport("mqrt.dll", ExactSpelling = true)]
static extern int MQGetPrivateComputerInformation(
[MarshalAs(UnmanagedType.LPWStr)] string lpwcsComputerName, // LPCWSTR optional
IntPtr pPrivateProps // MQPRIVATEPROPS* in/out
);<DllImport("mqrt.dll", ExactSpelling:=True)>
Public Shared Function MQGetPrivateComputerInformation(
<MarshalAs(UnmanagedType.LPWStr)> lpwcsComputerName As String, ' LPCWSTR optional
pPrivateProps As IntPtr ' MQPRIVATEPROPS* in/out
) As Integer
End Function' lpwcsComputerName : LPCWSTR optional
' pPrivateProps : MQPRIVATEPROPS* in/out
Declare PtrSafe Function MQGetPrivateComputerInformation Lib "mqrt" ( _
ByVal lpwcsComputerName As LongPtr, _
ByVal pPrivateProps As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MQGetPrivateComputerInformation = ctypes.windll.mqrt.MQGetPrivateComputerInformation
MQGetPrivateComputerInformation.restype = ctypes.c_int
MQGetPrivateComputerInformation.argtypes = [
wintypes.LPCWSTR, # lpwcsComputerName : LPCWSTR optional
ctypes.c_void_p, # pPrivateProps : MQPRIVATEPROPS* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('mqrt.dll')
MQGetPrivateComputerInformation = Fiddle::Function.new(
lib['MQGetPrivateComputerInformation'],
[
Fiddle::TYPE_VOIDP, # lpwcsComputerName : LPCWSTR optional
Fiddle::TYPE_VOIDP, # pPrivateProps : MQPRIVATEPROPS* in/out
],
Fiddle::TYPE_INT)#[link(name = "mqrt")]
extern "system" {
fn MQGetPrivateComputerInformation(
lpwcsComputerName: *const u16, // LPCWSTR optional
pPrivateProps: *mut MQPRIVATEPROPS // MQPRIVATEPROPS* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("mqrt.dll")]
public static extern int MQGetPrivateComputerInformation([MarshalAs(UnmanagedType.LPWStr)] string lpwcsComputerName, IntPtr pPrivateProps);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mqrt_MQGetPrivateComputerInformation' -Namespace Win32 -PassThru
# $api::MQGetPrivateComputerInformation(lpwcsComputerName, pPrivateProps)#uselib "mqrt.dll"
#func global MQGetPrivateComputerInformation "MQGetPrivateComputerInformation" sptr, sptr
; MQGetPrivateComputerInformation lpwcsComputerName, varptr(pPrivateProps) ; 戻り値は stat
; lpwcsComputerName : LPCWSTR optional -> "sptr"
; pPrivateProps : MQPRIVATEPROPS* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "mqrt.dll" #cfunc global MQGetPrivateComputerInformation "MQGetPrivateComputerInformation" wstr, var ; res = MQGetPrivateComputerInformation(lpwcsComputerName, pPrivateProps) ; lpwcsComputerName : LPCWSTR optional -> "wstr" ; pPrivateProps : MQPRIVATEPROPS* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "mqrt.dll" #cfunc global MQGetPrivateComputerInformation "MQGetPrivateComputerInformation" wstr, sptr ; res = MQGetPrivateComputerInformation(lpwcsComputerName, varptr(pPrivateProps)) ; lpwcsComputerName : LPCWSTR optional -> "wstr" ; pPrivateProps : MQPRIVATEPROPS* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT MQGetPrivateComputerInformation(LPCWSTR lpwcsComputerName, MQPRIVATEPROPS* pPrivateProps) #uselib "mqrt.dll" #cfunc global MQGetPrivateComputerInformation "MQGetPrivateComputerInformation" wstr, var ; res = MQGetPrivateComputerInformation(lpwcsComputerName, pPrivateProps) ; lpwcsComputerName : LPCWSTR optional -> "wstr" ; pPrivateProps : MQPRIVATEPROPS* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT MQGetPrivateComputerInformation(LPCWSTR lpwcsComputerName, MQPRIVATEPROPS* pPrivateProps) #uselib "mqrt.dll" #cfunc global MQGetPrivateComputerInformation "MQGetPrivateComputerInformation" wstr, intptr ; res = MQGetPrivateComputerInformation(lpwcsComputerName, varptr(pPrivateProps)) ; lpwcsComputerName : LPCWSTR optional -> "wstr" ; pPrivateProps : MQPRIVATEPROPS* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mqrt = windows.NewLazySystemDLL("mqrt.dll")
procMQGetPrivateComputerInformation = mqrt.NewProc("MQGetPrivateComputerInformation")
)
// lpwcsComputerName (LPCWSTR optional), pPrivateProps (MQPRIVATEPROPS* in/out)
r1, _, err := procMQGetPrivateComputerInformation.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpwcsComputerName))),
uintptr(pPrivateProps),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction MQGetPrivateComputerInformation(
lpwcsComputerName: PWideChar; // LPCWSTR optional
pPrivateProps: Pointer // MQPRIVATEPROPS* in/out
): Integer; stdcall;
external 'mqrt.dll' name 'MQGetPrivateComputerInformation';result := DllCall("mqrt\MQGetPrivateComputerInformation"
, "WStr", lpwcsComputerName ; LPCWSTR optional
, "Ptr", pPrivateProps ; MQPRIVATEPROPS* in/out
, "Int") ; return: HRESULT●MQGetPrivateComputerInformation(lpwcsComputerName, pPrivateProps) = DLL("mqrt.dll", "int MQGetPrivateComputerInformation(char*, void*)")
# 呼び出し: MQGetPrivateComputerInformation(lpwcsComputerName, pPrivateProps)
# lpwcsComputerName : LPCWSTR optional -> "char*"
# pPrivateProps : MQPRIVATEPROPS* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。