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

DispatcherQueueOptions

構造体
サイズx64: 12 バイト / x86: 12 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0本構造体のバイトサイズで、sizeof(DispatcherQueueOptions)を設定する。
threadTypeDISPATCHERQUEUE_THREAD_TYPE4+4+4ディスパッチャーキューを動作させるスレッド種別(専用/現在)を示す列挙値。
apartmentTypeDISPATCHERQUEUE_THREAD_APARTMENTTYPE4+8+8COMアパートメントの初期化種別(STA/MTA/未初期化)を示す列挙値。

各言語での定義

#include <windows.h>

// DispatcherQueueOptions  (x64 12 / x86 12 バイト)
typedef struct DispatcherQueueOptions {
    DWORD dwSize;
    DISPATCHERQUEUE_THREAD_TYPE threadType;
    DISPATCHERQUEUE_THREAD_APARTMENTTYPE apartmentType;
} DispatcherQueueOptions;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DispatcherQueueOptions
{
    public uint dwSize;
    public int threadType;
    public int apartmentType;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DispatcherQueueOptions
    Public dwSize As UInteger
    Public threadType As Integer
    Public apartmentType As Integer
End Structure
import ctypes
from ctypes import wintypes

class DispatcherQueueOptions(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("threadType", ctypes.c_int),
        ("apartmentType", ctypes.c_int),
    ]
#[repr(C)]
pub struct DispatcherQueueOptions {
    pub dwSize: u32,
    pub threadType: i32,
    pub apartmentType: i32,
}
import "golang.org/x/sys/windows"

type DispatcherQueueOptions struct {
	dwSize uint32
	threadType int32
	apartmentType int32
}
type
  DispatcherQueueOptions = record
    dwSize: DWORD;
    threadType: Integer;
    apartmentType: Integer;
  end;
const DispatcherQueueOptions = extern struct {
    dwSize: u32,
    threadType: i32,
    apartmentType: i32,
};
type
  DispatcherQueueOptions {.bycopy.} = object
    dwSize: uint32
    threadType: int32
    apartmentType: int32
struct DispatcherQueueOptions
{
    uint dwSize;
    int threadType;
    int apartmentType;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DispatcherQueueOptions サイズ: 12 バイト(x64)
dim st, 3    ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; threadType : DISPATCHERQUEUE_THREAD_TYPE (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; apartmentType : DISPATCHERQUEUE_THREAD_APARTMENTTYPE (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DispatcherQueueOptions
    #field int dwSize
    #field int threadType
    #field int apartmentType
#endstruct

stdim st, DispatcherQueueOptions        ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize