Win32 API 日本語リファレンス
ホームStorage.Xps.Printing › XPS_JOB_STATUS

XPS_JOB_STATUS

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

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

フィールド

フィールドサイズx64x86説明
jobIdDWORD4+0+0印刷ジョブに割り当てられているスプーラーのジョブ ID です。ジョブ ID がまだ割り当てられていない場合、jobId は 0 になります。
currentDocumentINT4+4+4印刷ジョブ内で最後に処理されたドキュメントの 0 から始まるインデックスです。0 が最初のドキュメント、1 が次のドキュメント、というように続きます。処理されたドキュメントがない場合、currentDocument の値は -1 になります。
currentPageINT4+8+8現在のドキュメント内で最後に処理されたページの 0 から始まるインデックスです。0 が最初のページ、1 が次のページ、というように続きます。処理されたページがない場合、currentPage の値は -1 になります。
currentPageTotalINT4+12+12印刷ジョブによって処理されたページ数の累計です。ジョブの開始時、この値は 0 です。ジョブが各ドキュメントの各ページを処理するたびに、この値は単調に増加します。
completionXPS_JOB_COMPLETION4+16+16ジョブの完了状態を示す XPS_JOB_COMPLETION 値です。この値は、StartXpsPrintJobcompletionEvent パラメーターで渡されたイベントがジョブの終了時にシグナル状態になったときに変化します。印刷ジョブが失敗した場合、この値は XPS_JOB_FAILED になり、jobStatus には失敗のエラー コードが格納されます。
jobStatusHRESULT4+20+20ジョブのエラー状態です。ジョブがエラーなしで終了した場合、この値は S_OK になります。エラーによって印刷ジョブが終了した場合、この値は失敗のエラー コードになります。

公式ドキュメント

[XPS_JOB_STATUS はサポートされておらず、将来変更されるか使用できなくなる可能性があります。]

ジョブの状態のスナップショットを格納します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// XPS_JOB_STATUS  (x64 24 / x86 24 バイト)
typedef struct XPS_JOB_STATUS {
    DWORD jobId;
    INT currentDocument;
    INT currentPage;
    INT currentPageTotal;
    XPS_JOB_COMPLETION completion;
    HRESULT jobStatus;
} XPS_JOB_STATUS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct XPS_JOB_STATUS
{
    public uint jobId;
    public int currentDocument;
    public int currentPage;
    public int currentPageTotal;
    public int completion;
    public int jobStatus;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure XPS_JOB_STATUS
    Public jobId As UInteger
    Public currentDocument As Integer
    Public currentPage As Integer
    Public currentPageTotal As Integer
    Public completion As Integer
    Public jobStatus As Integer
End Structure
import ctypes
from ctypes import wintypes

class XPS_JOB_STATUS(ctypes.Structure):
    _fields_ = [
        ("jobId", wintypes.DWORD),
        ("currentDocument", ctypes.c_int),
        ("currentPage", ctypes.c_int),
        ("currentPageTotal", ctypes.c_int),
        ("completion", ctypes.c_int),
        ("jobStatus", ctypes.c_int),
    ]
#[repr(C)]
pub struct XPS_JOB_STATUS {
    pub jobId: u32,
    pub currentDocument: i32,
    pub currentPage: i32,
    pub currentPageTotal: i32,
    pub completion: i32,
    pub jobStatus: i32,
}
import "golang.org/x/sys/windows"

type XPS_JOB_STATUS struct {
	jobId uint32
	currentDocument int32
	currentPage int32
	currentPageTotal int32
	completion int32
	jobStatus int32
}
type
  XPS_JOB_STATUS = record
    jobId: DWORD;
    currentDocument: Integer;
    currentPage: Integer;
    currentPageTotal: Integer;
    completion: Integer;
    jobStatus: Integer;
  end;
const XPS_JOB_STATUS = extern struct {
    jobId: u32,
    currentDocument: i32,
    currentPage: i32,
    currentPageTotal: i32,
    completion: i32,
    jobStatus: i32,
};
type
  XPS_JOB_STATUS {.bycopy.} = object
    jobId: uint32
    currentDocument: int32
    currentPage: int32
    currentPageTotal: int32
    completion: int32
    jobStatus: int32
struct XPS_JOB_STATUS
{
    uint jobId;
    int currentDocument;
    int currentPage;
    int currentPageTotal;
    int completion;
    int jobStatus;
}

HSP用 定義

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

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

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