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

RtwqAllocateSerialWorkQueue

関数
順次実行用のシリアル作業キューを割り当てる。
DLLRTWorkQ.dll呼出規約winapi対応OSWindows 8.1 以降

シグネチャ

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

HRESULT RtwqAllocateSerialWorkQueue(
    DWORD workQueueIdIn,
    DWORD* workQueueIdOut
);

パラメーター

名前方向
workQueueIdInDWORDin
workQueueIdOutDWORD*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT RtwqAllocateSerialWorkQueue(
    DWORD workQueueIdIn,
    DWORD* workQueueIdOut
);
[DllImport("RTWorkQ.dll", ExactSpelling = true)]
static extern int RtwqAllocateSerialWorkQueue(
    uint workQueueIdIn,   // DWORD
    out uint workQueueIdOut   // DWORD* out
);
<DllImport("RTWorkQ.dll", ExactSpelling:=True)>
Public Shared Function RtwqAllocateSerialWorkQueue(
    workQueueIdIn As UInteger,   ' DWORD
    <Out> ByRef workQueueIdOut As UInteger   ' DWORD* out
) As Integer
End Function
' workQueueIdIn : DWORD
' workQueueIdOut : DWORD* out
Declare PtrSafe Function RtwqAllocateSerialWorkQueue Lib "rtworkq" ( _
    ByVal workQueueIdIn As Long, _
    ByRef workQueueIdOut As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RtwqAllocateSerialWorkQueue = ctypes.windll.rtworkq.RtwqAllocateSerialWorkQueue
RtwqAllocateSerialWorkQueue.restype = ctypes.c_int
RtwqAllocateSerialWorkQueue.argtypes = [
    wintypes.DWORD,  # workQueueIdIn : DWORD
    ctypes.POINTER(wintypes.DWORD),  # workQueueIdOut : DWORD* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RTWorkQ.dll')
RtwqAllocateSerialWorkQueue = Fiddle::Function.new(
  lib['RtwqAllocateSerialWorkQueue'],
  [
    -Fiddle::TYPE_INT,  # workQueueIdIn : DWORD
    Fiddle::TYPE_VOIDP,  # workQueueIdOut : DWORD* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "rtworkq")]
extern "system" {
    fn RtwqAllocateSerialWorkQueue(
        workQueueIdIn: u32,  // DWORD
        workQueueIdOut: *mut u32  // DWORD* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RTWorkQ.dll")]
public static extern int RtwqAllocateSerialWorkQueue(uint workQueueIdIn, out uint workQueueIdOut);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RTWorkQ_RtwqAllocateSerialWorkQueue' -Namespace Win32 -PassThru
# $api::RtwqAllocateSerialWorkQueue(workQueueIdIn, workQueueIdOut)
#uselib "RTWorkQ.dll"
#func global RtwqAllocateSerialWorkQueue "RtwqAllocateSerialWorkQueue" sptr, sptr
; RtwqAllocateSerialWorkQueue workQueueIdIn, varptr(workQueueIdOut)   ; 戻り値は stat
; workQueueIdIn : DWORD -> "sptr"
; workQueueIdOut : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "RTWorkQ.dll"
#cfunc global RtwqAllocateSerialWorkQueue "RtwqAllocateSerialWorkQueue" int, var
; res = RtwqAllocateSerialWorkQueue(workQueueIdIn, workQueueIdOut)
; workQueueIdIn : DWORD -> "int"
; workQueueIdOut : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT RtwqAllocateSerialWorkQueue(DWORD workQueueIdIn, DWORD* workQueueIdOut)
#uselib "RTWorkQ.dll"
#cfunc global RtwqAllocateSerialWorkQueue "RtwqAllocateSerialWorkQueue" int, var
; res = RtwqAllocateSerialWorkQueue(workQueueIdIn, workQueueIdOut)
; workQueueIdIn : DWORD -> "int"
; workQueueIdOut : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rtworkq = windows.NewLazySystemDLL("RTWorkQ.dll")
	procRtwqAllocateSerialWorkQueue = rtworkq.NewProc("RtwqAllocateSerialWorkQueue")
)

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