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

MQCreateCursor

関数
キュー内を走査するためのカーソルを作成する。
DLLmqrt.dll呼出規約winapi

シグネチャ

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

HRESULT MQCreateCursor(
    INT_PTR hQueue,
    HANDLE* phCursor
);

パラメーター

名前方向
hQueueINT_PTRin
phCursorHANDLE*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

MQCreateCursor = ctypes.windll.mqrt.MQCreateCursor
MQCreateCursor.restype = ctypes.c_int
MQCreateCursor.argtypes = [
    ctypes.c_ssize_t,  # hQueue : INT_PTR
    ctypes.c_void_p,  # phCursor : HANDLE* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mqrt = windows.NewLazySystemDLL("mqrt.dll")
	procMQCreateCursor = mqrt.NewProc("MQCreateCursor")
)

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