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

MQMoveMessage

関数
サブキュー間でメッセージを移動する。
DLLmqrt.dll呼出規約winapi

シグネチャ

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

HRESULT MQMoveMessage(
    INT_PTR hSourceQueue,
    INT_PTR hDestinationQueue,
    ULONGLONG ullLookupId,
    ITransaction* pTransaction   // optional
);

パラメーター

名前方向
hSourceQueueINT_PTRin
hDestinationQueueINT_PTRin
ullLookupIdULONGLONGin
pTransactionITransaction*inoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT MQMoveMessage(
    INT_PTR hSourceQueue,
    INT_PTR hDestinationQueue,
    ULONGLONG ullLookupId,
    ITransaction* pTransaction   // optional
);
[DllImport("mqrt.dll", ExactSpelling = true)]
static extern int MQMoveMessage(
    IntPtr hSourceQueue,   // INT_PTR
    IntPtr hDestinationQueue,   // INT_PTR
    ulong ullLookupId,   // ULONGLONG
    IntPtr pTransaction   // ITransaction* optional
);
<DllImport("mqrt.dll", ExactSpelling:=True)>
Public Shared Function MQMoveMessage(
    hSourceQueue As IntPtr,   ' INT_PTR
    hDestinationQueue As IntPtr,   ' INT_PTR
    ullLookupId As ULong,   ' ULONGLONG
    pTransaction As IntPtr   ' ITransaction* optional
) As Integer
End Function
' hSourceQueue : INT_PTR
' hDestinationQueue : INT_PTR
' ullLookupId : ULONGLONG
' pTransaction : ITransaction* optional
Declare PtrSafe Function MQMoveMessage Lib "mqrt" ( _
    ByVal hSourceQueue As LongPtr, _
    ByVal hDestinationQueue As LongPtr, _
    ByVal ullLookupId As LongLong, _
    ByVal pTransaction As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MQMoveMessage = ctypes.windll.mqrt.MQMoveMessage
MQMoveMessage.restype = ctypes.c_int
MQMoveMessage.argtypes = [
    ctypes.c_ssize_t,  # hSourceQueue : INT_PTR
    ctypes.c_ssize_t,  # hDestinationQueue : INT_PTR
    ctypes.c_ulonglong,  # ullLookupId : ULONGLONG
    ctypes.c_void_p,  # pTransaction : ITransaction* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('mqrt.dll')
MQMoveMessage = Fiddle::Function.new(
  lib['MQMoveMessage'],
  [
    Fiddle::TYPE_INTPTR_T,  # hSourceQueue : INT_PTR
    Fiddle::TYPE_INTPTR_T,  # hDestinationQueue : INT_PTR
    -Fiddle::TYPE_LONG_LONG,  # ullLookupId : ULONGLONG
    Fiddle::TYPE_VOIDP,  # pTransaction : ITransaction* optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "mqrt")]
extern "system" {
    fn MQMoveMessage(
        hSourceQueue: isize,  // INT_PTR
        hDestinationQueue: isize,  // INT_PTR
        ullLookupId: u64,  // ULONGLONG
        pTransaction: *mut core::ffi::c_void  // ITransaction* optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("mqrt.dll")]
public static extern int MQMoveMessage(IntPtr hSourceQueue, IntPtr hDestinationQueue, ulong ullLookupId, IntPtr pTransaction);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mqrt_MQMoveMessage' -Namespace Win32 -PassThru
# $api::MQMoveMessage(hSourceQueue, hDestinationQueue, ullLookupId, pTransaction)
#uselib "mqrt.dll"
#func global MQMoveMessage "MQMoveMessage" sptr, sptr, sptr, sptr
; MQMoveMessage hSourceQueue, hDestinationQueue, ullLookupId, pTransaction   ; 戻り値は stat
; hSourceQueue : INT_PTR -> "sptr"
; hDestinationQueue : INT_PTR -> "sptr"
; ullLookupId : ULONGLONG -> "sptr"
; pTransaction : ITransaction* optional -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "mqrt.dll"
#cfunc global MQMoveMessage "MQMoveMessage" sptr, sptr, int64, sptr
; res = MQMoveMessage(hSourceQueue, hDestinationQueue, ullLookupId, pTransaction)
; hSourceQueue : INT_PTR -> "sptr"
; hDestinationQueue : INT_PTR -> "sptr"
; ullLookupId : ULONGLONG -> "int64"
; pTransaction : ITransaction* optional -> "sptr"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
; HRESULT MQMoveMessage(INT_PTR hSourceQueue, INT_PTR hDestinationQueue, ULONGLONG ullLookupId, ITransaction* pTransaction)
#uselib "mqrt.dll"
#cfunc global MQMoveMessage "MQMoveMessage" intptr, intptr, int64, intptr
; res = MQMoveMessage(hSourceQueue, hDestinationQueue, ullLookupId, pTransaction)
; hSourceQueue : INT_PTR -> "intptr"
; hDestinationQueue : INT_PTR -> "intptr"
; ullLookupId : ULONGLONG -> "int64"
; pTransaction : ITransaction* optional -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mqrt = windows.NewLazySystemDLL("mqrt.dll")
	procMQMoveMessage = mqrt.NewProc("MQMoveMessage")
)

// hSourceQueue (INT_PTR), hDestinationQueue (INT_PTR), ullLookupId (ULONGLONG), pTransaction (ITransaction* optional)
r1, _, err := procMQMoveMessage.Call(
	uintptr(hSourceQueue),
	uintptr(hDestinationQueue),
	uintptr(ullLookupId),
	uintptr(pTransaction),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function MQMoveMessage(
  hSourceQueue: NativeInt;   // INT_PTR
  hDestinationQueue: NativeInt;   // INT_PTR
  ullLookupId: UInt64;   // ULONGLONG
  pTransaction: Pointer   // ITransaction* optional
): Integer; stdcall;
  external 'mqrt.dll' name 'MQMoveMessage';
result := DllCall("mqrt\MQMoveMessage"
    , "Ptr", hSourceQueue   ; INT_PTR
    , "Ptr", hDestinationQueue   ; INT_PTR
    , "Int64", ullLookupId   ; ULONGLONG
    , "Ptr", pTransaction   ; ITransaction* optional
    , "Int")   ; return: HRESULT
●MQMoveMessage(hSourceQueue, hDestinationQueue, ullLookupId, pTransaction) = DLL("mqrt.dll", "int MQMoveMessage(int, int, qword, void*)")
# 呼び出し: MQMoveMessage(hSourceQueue, hDestinationQueue, ullLookupId, pTransaction)
# hSourceQueue : INT_PTR -> "int"
# hDestinationQueue : INT_PTR -> "int"
# ullLookupId : ULONGLONG -> "qword"
# pTransaction : ITransaction* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。