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

MQDeleteQueue

関数
指定したメッセージキューを削除する。
DLLmqrt.dll呼出規約winapi

シグネチャ

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

HRESULT MQDeleteQueue(
    LPCWSTR lpwcsFormatName
);

パラメーター

名前方向
lpwcsFormatNameLPCWSTRin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

MQDeleteQueue = ctypes.windll.mqrt.MQDeleteQueue
MQDeleteQueue.restype = ctypes.c_int
MQDeleteQueue.argtypes = [
    wintypes.LPCWSTR,  # lpwcsFormatName : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mqrt = windows.NewLazySystemDLL("mqrt.dll")
	procMQDeleteQueue = mqrt.NewProc("MQDeleteQueue")
)

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