ホーム › System.MessageQueuing › MQMoveMessage
MQMoveMessage
関数サブキュー間でメッセージを移動する。
シグネチャ
// mqrt.dll
#include <windows.h>
HRESULT MQMoveMessage(
INT_PTR hSourceQueue,
INT_PTR hDestinationQueue,
ULONGLONG ullLookupId,
ITransaction* pTransaction // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hSourceQueue | INT_PTR | in | メッセージの移動元キューのハンドルを指定する。 |
| hDestinationQueue | INT_PTR | in | メッセージの移動先キュー(サブキュー等)のハンドルを指定する。 |
| ullLookupId | ULONGLONG | in | 移動対象メッセージを一意に識別するルックアップIDを指定する。 |
| pTransaction | ITransaction* | inoptional | 移動を実行するトランザクションへのITransactionポインタ。NULLや特殊定数で非トランザクションとなる。 |
戻り値の型: 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 // HRESULTfunction 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)。const std = @import("std");
extern "mqrt" fn MQMoveMessage(
hSourceQueue: isize, // INT_PTR
hDestinationQueue: isize, // INT_PTR
ullLookupId: u64, // ULONGLONG
pTransaction: ?*anyopaque // ITransaction* optional
) callconv(std.os.windows.WINAPI) i32;proc MQMoveMessage(
hSourceQueue: int, # INT_PTR
hDestinationQueue: int, # INT_PTR
ullLookupId: uint64, # ULONGLONG
pTransaction: pointer # ITransaction* optional
): int32 {.importc: "MQMoveMessage", stdcall, dynlib: "mqrt.dll".}pragma(lib, "mqrt");
extern(Windows)
int MQMoveMessage(
ptrdiff_t hSourceQueue, // INT_PTR
ptrdiff_t hDestinationQueue, // INT_PTR
ulong ullLookupId, // ULONGLONG
void* pTransaction // ITransaction* optional
);ccall((:MQMoveMessage, "mqrt.dll"), stdcall, Int32,
(Int, Int, UInt64, Ptr{Cvoid}),
hSourceQueue, hDestinationQueue, ullLookupId, pTransaction)
# hSourceQueue : INT_PTR -> Int
# hDestinationQueue : INT_PTR -> Int
# ullLookupId : ULONGLONG -> UInt64
# pTransaction : ITransaction* optional -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t MQMoveMessage(
intptr_t hSourceQueue,
intptr_t hDestinationQueue,
uint64_t ullLookupId,
void* pTransaction);
]]
local mqrt = ffi.load("mqrt")
-- mqrt.MQMoveMessage(hSourceQueue, hDestinationQueue, ullLookupId, pTransaction)
-- hSourceQueue : INT_PTR
-- hDestinationQueue : INT_PTR
-- ullLookupId : ULONGLONG
-- pTransaction : ITransaction* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('mqrt.dll');
const MQMoveMessage = lib.func('__stdcall', 'MQMoveMessage', 'int32_t', ['intptr_t', 'intptr_t', 'uint64_t', 'void *']);
// MQMoveMessage(hSourceQueue, hDestinationQueue, ullLookupId, pTransaction)
// hSourceQueue : INT_PTR -> 'intptr_t'
// hDestinationQueue : INT_PTR -> 'intptr_t'
// ullLookupId : ULONGLONG -> 'uint64_t'
// pTransaction : ITransaction* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("mqrt.dll", {
MQMoveMessage: { parameters: ["isize", "isize", "u64", "pointer"], result: "i32" },
});
// lib.symbols.MQMoveMessage(hSourceQueue, hDestinationQueue, ullLookupId, pTransaction)
// hSourceQueue : INT_PTR -> "isize"
// hDestinationQueue : INT_PTR -> "isize"
// ullLookupId : ULONGLONG -> "u64"
// pTransaction : ITransaction* optional -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t MQMoveMessage(
intptr_t hSourceQueue,
intptr_t hDestinationQueue,
uint64_t ullLookupId,
void* pTransaction);
C, "mqrt.dll");
// $ffi->MQMoveMessage(hSourceQueue, hDestinationQueue, ullLookupId, pTransaction);
// hSourceQueue : INT_PTR
// hDestinationQueue : INT_PTR
// ullLookupId : ULONGLONG
// pTransaction : ITransaction* optional
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Mqrt extends StdCallLibrary {
Mqrt INSTANCE = Native.load("mqrt", Mqrt.class);
int MQMoveMessage(
long hSourceQueue, // INT_PTR
long hDestinationQueue, // INT_PTR
long ullLookupId, // ULONGLONG
Pointer pTransaction // ITransaction* optional
);
}@[Link("mqrt")]
lib Libmqrt
fun MQMoveMessage = MQMoveMessage(
hSourceQueue : LibC::SSizeT, # INT_PTR
hDestinationQueue : LibC::SSizeT, # INT_PTR
ullLookupId : UInt64, # ULONGLONG
pTransaction : Void* # ITransaction* optional
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef MQMoveMessageNative = Int32 Function(IntPtr, IntPtr, Uint64, Pointer<Void>);
typedef MQMoveMessageDart = int Function(int, int, int, Pointer<Void>);
final MQMoveMessage = DynamicLibrary.open('mqrt.dll')
.lookupFunction<MQMoveMessageNative, MQMoveMessageDart>('MQMoveMessage');
// hSourceQueue : INT_PTR -> IntPtr
// hDestinationQueue : INT_PTR -> IntPtr
// ullLookupId : ULONGLONG -> Uint64
// pTransaction : ITransaction* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function MQMoveMessage(
hSourceQueue: NativeInt; // INT_PTR
hDestinationQueue: NativeInt; // INT_PTR
ullLookupId: UInt64; // ULONGLONG
pTransaction: Pointer // ITransaction* optional
): Integer; stdcall;
external 'mqrt.dll' name 'MQMoveMessage';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "MQMoveMessage"
c_MQMoveMessage :: CIntPtr -> CIntPtr -> Word64 -> Ptr () -> IO Int32
-- hSourceQueue : INT_PTR -> CIntPtr
-- hDestinationQueue : INT_PTR -> CIntPtr
-- ullLookupId : ULONGLONG -> Word64
-- pTransaction : ITransaction* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let mqmovemessage =
foreign "MQMoveMessage"
(intptr_t @-> intptr_t @-> uint64_t @-> (ptr void) @-> returning int32_t)
(* hSourceQueue : INT_PTR -> intptr_t *)
(* hDestinationQueue : INT_PTR -> intptr_t *)
(* ullLookupId : ULONGLONG -> uint64_t *)
(* pTransaction : ITransaction* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library mqrt (t "mqrt.dll"))
(cffi:use-foreign-library mqrt)
(cffi:defcfun ("MQMoveMessage" mqmove-message :convention :stdcall) :int32
(h-source-queue :int64) ; INT_PTR
(h-destination-queue :int64) ; INT_PTR
(ull-lookup-id :uint64) ; ULONGLONG
(p-transaction :pointer)) ; ITransaction* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $MQMoveMessage = Win32::API::More->new('mqrt',
'int MQMoveMessage(LPARAM hSourceQueue, LPARAM hDestinationQueue, UINT64 ullLookupId, LPVOID pTransaction)');
# my $ret = $MQMoveMessage->Call($hSourceQueue, $hDestinationQueue, $ullLookupId, $pTransaction);
# hSourceQueue : INT_PTR -> LPARAM
# hDestinationQueue : INT_PTR -> LPARAM
# ullLookupId : ULONGLONG -> UINT64
# pTransaction : ITransaction* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型