ホーム › System.Threading › RtwqGetWorkQueueMMCSSTaskId
RtwqGetWorkQueueMMCSSTaskId
関数作業キューに関連付けられたMMCSSタスクIDを取得する。
シグネチャ
// RTWorkQ.dll
#include <windows.h>
HRESULT RtwqGetWorkQueueMMCSSTaskId(
DWORD workQueueId,
DWORD* taskId
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| workQueueId | DWORD | in | ワークキューの識別子です。この識別子は RtwqAllocateWorkQueue 関数によって取得されます。 |
| taskId | DWORD* | out | タスク識別子を受け取ります。 |
戻り値の型: HRESULT
公式ドキュメント
このワークキューに現在関連付けられている Multimedia Class Scheduler Service (MMCSS) のタスク識別子を取得します。(RtwqGetWorkQueueMMCSSTaskId)
戻り値
この関数が成功した場合は S_OK を返します。それ以外の場合は HRESULT エラーコードを返します。
解説(Remarks)
ワークキューを MMCSS タスクに関連付けるには、RtwqBeginRegisterWorkQueueWithMMCSSEx を呼び出します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// RTWorkQ.dll
#include <windows.h>
HRESULT RtwqGetWorkQueueMMCSSTaskId(
DWORD workQueueId,
DWORD* taskId
);[DllImport("RTWorkQ.dll", ExactSpelling = true)]
static extern int RtwqGetWorkQueueMMCSSTaskId(
uint workQueueId, // DWORD
out uint taskId // DWORD* out
);<DllImport("RTWorkQ.dll", ExactSpelling:=True)>
Public Shared Function RtwqGetWorkQueueMMCSSTaskId(
workQueueId As UInteger, ' DWORD
<Out> ByRef taskId As UInteger ' DWORD* out
) As Integer
End Function' workQueueId : DWORD
' taskId : DWORD* out
Declare PtrSafe Function RtwqGetWorkQueueMMCSSTaskId Lib "rtworkq" ( _
ByVal workQueueId As Long, _
ByRef taskId As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RtwqGetWorkQueueMMCSSTaskId = ctypes.windll.rtworkq.RtwqGetWorkQueueMMCSSTaskId
RtwqGetWorkQueueMMCSSTaskId.restype = ctypes.c_int
RtwqGetWorkQueueMMCSSTaskId.argtypes = [
wintypes.DWORD, # workQueueId : DWORD
ctypes.POINTER(wintypes.DWORD), # taskId : DWORD* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RTWorkQ.dll')
RtwqGetWorkQueueMMCSSTaskId = Fiddle::Function.new(
lib['RtwqGetWorkQueueMMCSSTaskId'],
[
-Fiddle::TYPE_INT, # workQueueId : DWORD
Fiddle::TYPE_VOIDP, # taskId : DWORD* out
],
Fiddle::TYPE_INT)#[link(name = "rtworkq")]
extern "system" {
fn RtwqGetWorkQueueMMCSSTaskId(
workQueueId: u32, // DWORD
taskId: *mut u32 // DWORD* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RTWorkQ.dll")]
public static extern int RtwqGetWorkQueueMMCSSTaskId(uint workQueueId, out uint taskId);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RTWorkQ_RtwqGetWorkQueueMMCSSTaskId' -Namespace Win32 -PassThru
# $api::RtwqGetWorkQueueMMCSSTaskId(workQueueId, taskId)#uselib "RTWorkQ.dll"
#func global RtwqGetWorkQueueMMCSSTaskId "RtwqGetWorkQueueMMCSSTaskId" sptr, sptr
; RtwqGetWorkQueueMMCSSTaskId workQueueId, varptr(taskId) ; 戻り値は stat
; workQueueId : DWORD -> "sptr"
; taskId : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "RTWorkQ.dll" #cfunc global RtwqGetWorkQueueMMCSSTaskId "RtwqGetWorkQueueMMCSSTaskId" int, var ; res = RtwqGetWorkQueueMMCSSTaskId(workQueueId, taskId) ; workQueueId : DWORD -> "int" ; taskId : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "RTWorkQ.dll" #cfunc global RtwqGetWorkQueueMMCSSTaskId "RtwqGetWorkQueueMMCSSTaskId" int, sptr ; res = RtwqGetWorkQueueMMCSSTaskId(workQueueId, varptr(taskId)) ; workQueueId : DWORD -> "int" ; taskId : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT RtwqGetWorkQueueMMCSSTaskId(DWORD workQueueId, DWORD* taskId) #uselib "RTWorkQ.dll" #cfunc global RtwqGetWorkQueueMMCSSTaskId "RtwqGetWorkQueueMMCSSTaskId" int, var ; res = RtwqGetWorkQueueMMCSSTaskId(workQueueId, taskId) ; workQueueId : DWORD -> "int" ; taskId : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT RtwqGetWorkQueueMMCSSTaskId(DWORD workQueueId, DWORD* taskId) #uselib "RTWorkQ.dll" #cfunc global RtwqGetWorkQueueMMCSSTaskId "RtwqGetWorkQueueMMCSSTaskId" int, intptr ; res = RtwqGetWorkQueueMMCSSTaskId(workQueueId, varptr(taskId)) ; workQueueId : DWORD -> "int" ; taskId : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rtworkq = windows.NewLazySystemDLL("RTWorkQ.dll")
procRtwqGetWorkQueueMMCSSTaskId = rtworkq.NewProc("RtwqGetWorkQueueMMCSSTaskId")
)
// workQueueId (DWORD), taskId (DWORD* out)
r1, _, err := procRtwqGetWorkQueueMMCSSTaskId.Call(
uintptr(workQueueId),
uintptr(taskId),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction RtwqGetWorkQueueMMCSSTaskId(
workQueueId: DWORD; // DWORD
taskId: Pointer // DWORD* out
): Integer; stdcall;
external 'RTWorkQ.dll' name 'RtwqGetWorkQueueMMCSSTaskId';result := DllCall("RTWorkQ\RtwqGetWorkQueueMMCSSTaskId"
, "UInt", workQueueId ; DWORD
, "Ptr", taskId ; DWORD* out
, "Int") ; return: HRESULT●RtwqGetWorkQueueMMCSSTaskId(workQueueId, taskId) = DLL("RTWorkQ.dll", "int RtwqGetWorkQueueMMCSSTaskId(dword, void*)")
# 呼び出し: RtwqGetWorkQueueMMCSSTaskId(workQueueId, taskId)
# workQueueId : DWORD -> "dword"
# taskId : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "rtworkq" fn RtwqGetWorkQueueMMCSSTaskId(
workQueueId: u32, // DWORD
taskId: [*c]u32 // DWORD* out
) callconv(std.os.windows.WINAPI) i32;proc RtwqGetWorkQueueMMCSSTaskId(
workQueueId: uint32, # DWORD
taskId: ptr uint32 # DWORD* out
): int32 {.importc: "RtwqGetWorkQueueMMCSSTaskId", stdcall, dynlib: "RTWorkQ.dll".}pragma(lib, "rtworkq");
extern(Windows)
int RtwqGetWorkQueueMMCSSTaskId(
uint workQueueId, // DWORD
uint* taskId // DWORD* out
);ccall((:RtwqGetWorkQueueMMCSSTaskId, "RTWorkQ.dll"), stdcall, Int32,
(UInt32, Ptr{UInt32}),
workQueueId, taskId)
# workQueueId : DWORD -> UInt32
# taskId : DWORD* out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t RtwqGetWorkQueueMMCSSTaskId(
uint32_t workQueueId,
uint32_t* taskId);
]]
local rtworkq = ffi.load("rtworkq")
-- rtworkq.RtwqGetWorkQueueMMCSSTaskId(workQueueId, taskId)
-- workQueueId : DWORD
-- taskId : DWORD* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('RTWorkQ.dll');
const RtwqGetWorkQueueMMCSSTaskId = lib.func('__stdcall', 'RtwqGetWorkQueueMMCSSTaskId', 'int32_t', ['uint32_t', 'uint32_t *']);
// RtwqGetWorkQueueMMCSSTaskId(workQueueId, taskId)
// workQueueId : DWORD -> 'uint32_t'
// taskId : DWORD* out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("RTWorkQ.dll", {
RtwqGetWorkQueueMMCSSTaskId: { parameters: ["u32", "pointer"], result: "i32" },
});
// lib.symbols.RtwqGetWorkQueueMMCSSTaskId(workQueueId, taskId)
// workQueueId : DWORD -> "u32"
// taskId : DWORD* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t RtwqGetWorkQueueMMCSSTaskId(
uint32_t workQueueId,
uint32_t* taskId);
C, "RTWorkQ.dll");
// $ffi->RtwqGetWorkQueueMMCSSTaskId(workQueueId, taskId);
// workQueueId : DWORD
// taskId : DWORD* out
// 構造体/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 Rtworkq extends StdCallLibrary {
Rtworkq INSTANCE = Native.load("rtworkq", Rtworkq.class);
int RtwqGetWorkQueueMMCSSTaskId(
int workQueueId, // DWORD
IntByReference taskId // DWORD* out
);
}@[Link("rtworkq")]
lib LibRTWorkQ
fun RtwqGetWorkQueueMMCSSTaskId = RtwqGetWorkQueueMMCSSTaskId(
workQueueId : UInt32, # DWORD
taskId : UInt32* # DWORD* out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef RtwqGetWorkQueueMMCSSTaskIdNative = Int32 Function(Uint32, Pointer<Uint32>);
typedef RtwqGetWorkQueueMMCSSTaskIdDart = int Function(int, Pointer<Uint32>);
final RtwqGetWorkQueueMMCSSTaskId = DynamicLibrary.open('RTWorkQ.dll')
.lookupFunction<RtwqGetWorkQueueMMCSSTaskIdNative, RtwqGetWorkQueueMMCSSTaskIdDart>('RtwqGetWorkQueueMMCSSTaskId');
// workQueueId : DWORD -> Uint32
// taskId : DWORD* out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function RtwqGetWorkQueueMMCSSTaskId(
workQueueId: DWORD; // DWORD
taskId: Pointer // DWORD* out
): Integer; stdcall;
external 'RTWorkQ.dll' name 'RtwqGetWorkQueueMMCSSTaskId';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "RtwqGetWorkQueueMMCSSTaskId"
c_RtwqGetWorkQueueMMCSSTaskId :: Word32 -> Ptr Word32 -> IO Int32
-- workQueueId : DWORD -> Word32
-- taskId : DWORD* out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let rtwqgetworkqueuemmcsstaskid =
foreign "RtwqGetWorkQueueMMCSSTaskId"
(uint32_t @-> (ptr uint32_t) @-> returning int32_t)
(* workQueueId : DWORD -> uint32_t *)
(* taskId : DWORD* out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library rtworkq (t "RTWorkQ.dll"))
(cffi:use-foreign-library rtworkq)
(cffi:defcfun ("RtwqGetWorkQueueMMCSSTaskId" rtwq-get-work-queue-mmcsstask-id :convention :stdcall) :int32
(work-queue-id :uint32) ; DWORD
(task-id :pointer)) ; DWORD* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $RtwqGetWorkQueueMMCSSTaskId = Win32::API::More->new('RTWorkQ',
'int RtwqGetWorkQueueMMCSSTaskId(DWORD workQueueId, LPVOID taskId)');
# my $ret = $RtwqGetWorkQueueMMCSSTaskId->Call($workQueueId, $taskId);
# workQueueId : DWORD -> DWORD
# taskId : DWORD* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。