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

MQCloseQueue

関数
開いているキューハンドルを閉じる。
DLLmqrt.dll呼出規約winapi

シグネチャ

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

HRESULT MQCloseQueue(
    INT_PTR hQueue
);

パラメーター

名前方向
hQueueINT_PTRin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

MQCloseQueue = ctypes.windll.mqrt.MQCloseQueue
MQCloseQueue.restype = ctypes.c_int
MQCloseQueue.argtypes = [
    ctypes.c_ssize_t,  # hQueue : INT_PTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('mqrt.dll')
MQCloseQueue = Fiddle::Function.new(
  lib['MQCloseQueue'],
  [
    Fiddle::TYPE_INTPTR_T,  # hQueue : INT_PTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "mqrt")]
extern "system" {
    fn MQCloseQueue(
        hQueue: isize  // INT_PTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("mqrt.dll")]
public static extern int MQCloseQueue(IntPtr hQueue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mqrt_MQCloseQueue' -Namespace Win32 -PassThru
# $api::MQCloseQueue(hQueue)
#uselib "mqrt.dll"
#func global MQCloseQueue "MQCloseQueue" sptr
; MQCloseQueue hQueue   ; 戻り値は stat
; hQueue : INT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "mqrt.dll"
#cfunc global MQCloseQueue "MQCloseQueue" sptr
; res = MQCloseQueue(hQueue)
; hQueue : INT_PTR -> "sptr"
; HRESULT MQCloseQueue(INT_PTR hQueue)
#uselib "mqrt.dll"
#cfunc global MQCloseQueue "MQCloseQueue" intptr
; res = MQCloseQueue(hQueue)
; hQueue : INT_PTR -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mqrt = windows.NewLazySystemDLL("mqrt.dll")
	procMQCloseQueue = mqrt.NewProc("MQCloseQueue")
)

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