ホーム › System.Threading › AvSetMmThreadPriority
AvSetMmThreadPriority
関数マルチメディアスレッドの優先度を設定する。
シグネチャ
// AVRT.dll
#include <windows.h>
BOOL AvSetMmThreadPriority(
AVRT_TASK_HANDLE AvrtHandle,
AVRT_PRIORITY Priority
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| AvrtHandle | AVRT_TASK_HANDLE | in |
| Priority | AVRT_PRIORITY | in |
戻り値の型: BOOL
各言語での呼び出し定義
// AVRT.dll
#include <windows.h>
BOOL AvSetMmThreadPriority(
AVRT_TASK_HANDLE AvrtHandle,
AVRT_PRIORITY Priority
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("AVRT.dll", SetLastError = true, ExactSpelling = true)]
static extern bool AvSetMmThreadPriority(
AVRT_TASK_HANDLE AvrtHandle, // AVRT_TASK_HANDLE
int Priority // AVRT_PRIORITY
);<DllImport("AVRT.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function AvSetMmThreadPriority(
AvrtHandle As AVRT_TASK_HANDLE, ' AVRT_TASK_HANDLE
Priority As Integer ' AVRT_PRIORITY
) As Boolean
End Function' AvrtHandle : AVRT_TASK_HANDLE
' Priority : AVRT_PRIORITY
Declare PtrSafe Function AvSetMmThreadPriority Lib "avrt" ( _
ByVal AvrtHandle As LongPtr, _
ByVal Priority As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
AvSetMmThreadPriority = ctypes.windll.avrt.AvSetMmThreadPriority
AvSetMmThreadPriority.restype = wintypes.BOOL
AvSetMmThreadPriority.argtypes = [
AVRT_TASK_HANDLE, # AvrtHandle : AVRT_TASK_HANDLE
ctypes.c_int, # Priority : AVRT_PRIORITY
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('AVRT.dll')
AvSetMmThreadPriority = Fiddle::Function.new(
lib['AvSetMmThreadPriority'],
[
Fiddle::TYPE_VOIDP, # AvrtHandle : AVRT_TASK_HANDLE
Fiddle::TYPE_INT, # Priority : AVRT_PRIORITY
],
Fiddle::TYPE_INT)#[link(name = "avrt")]
extern "system" {
fn AvSetMmThreadPriority(
AvrtHandle: AVRT_TASK_HANDLE, // AVRT_TASK_HANDLE
Priority: i32 // AVRT_PRIORITY
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("AVRT.dll", SetLastError = true)]
public static extern bool AvSetMmThreadPriority(AVRT_TASK_HANDLE AvrtHandle, int Priority);
"@
$api = Add-Type -MemberDefinition $sig -Name 'AVRT_AvSetMmThreadPriority' -Namespace Win32 -PassThru
# $api::AvSetMmThreadPriority(AvrtHandle, Priority)#uselib "AVRT.dll"
#func global AvSetMmThreadPriority "AvSetMmThreadPriority" sptr, sptr
; AvSetMmThreadPriority AvrtHandle, Priority ; 戻り値は stat
; AvrtHandle : AVRT_TASK_HANDLE -> "sptr"
; Priority : AVRT_PRIORITY -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "AVRT.dll"
#cfunc global AvSetMmThreadPriority "AvSetMmThreadPriority" int, int
; res = AvSetMmThreadPriority(AvrtHandle, Priority)
; AvrtHandle : AVRT_TASK_HANDLE -> "int"
; Priority : AVRT_PRIORITY -> "int"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。; BOOL AvSetMmThreadPriority(AVRT_TASK_HANDLE AvrtHandle, AVRT_PRIORITY Priority)
#uselib "AVRT.dll"
#cfunc global AvSetMmThreadPriority "AvSetMmThreadPriority" int, int
; res = AvSetMmThreadPriority(AvrtHandle, Priority)
; AvrtHandle : AVRT_TASK_HANDLE -> "int"
; Priority : AVRT_PRIORITY -> "int"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
avrt = windows.NewLazySystemDLL("AVRT.dll")
procAvSetMmThreadPriority = avrt.NewProc("AvSetMmThreadPriority")
)
// AvrtHandle (AVRT_TASK_HANDLE), Priority (AVRT_PRIORITY)
r1, _, err := procAvSetMmThreadPriority.Call(
uintptr(AvrtHandle),
uintptr(Priority),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction AvSetMmThreadPriority(
AvrtHandle: AVRT_TASK_HANDLE; // AVRT_TASK_HANDLE
Priority: Integer // AVRT_PRIORITY
): BOOL; stdcall;
external 'AVRT.dll' name 'AvSetMmThreadPriority';result := DllCall("AVRT\AvSetMmThreadPriority"
, "Ptr", AvrtHandle ; AVRT_TASK_HANDLE
, "Int", Priority ; AVRT_PRIORITY
, "Int") ; return: BOOL●AvSetMmThreadPriority(AvrtHandle, Priority) = DLL("AVRT.dll", "bool AvSetMmThreadPriority(void*, int)")
# 呼び出し: AvSetMmThreadPriority(AvrtHandle, Priority)
# AvrtHandle : AVRT_TASK_HANDLE -> "void*"
# Priority : AVRT_PRIORITY -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。