ホーム › UI.TabletPC › PROPERTY_METRICS
PROPERTY_METRICS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| nLogicalMin | INT | 4 | +0 | +0 | プロパティ値の論理的な最小値。 |
| nLogicalMax | INT | 4 | +4 | +4 | プロパティ値の論理的な最大値。 |
| Units | PROPERTY_UNITS | 4 | +8 | +8 | 値の単位を示す PROPERTY_UNITS 列挙値。 |
| fResolution | FLOAT | 4 | +12 | +12 | 単位あたりの分解能(解像度)を示す浮動小数点値。 |
各言語での定義
#include <windows.h>
// PROPERTY_METRICS (x64 16 / x86 16 バイト)
typedef struct PROPERTY_METRICS {
INT nLogicalMin;
INT nLogicalMax;
PROPERTY_UNITS Units;
FLOAT fResolution;
} PROPERTY_METRICS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PROPERTY_METRICS
{
public int nLogicalMin;
public int nLogicalMax;
public int Units;
public float fResolution;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PROPERTY_METRICS
Public nLogicalMin As Integer
Public nLogicalMax As Integer
Public Units As Integer
Public fResolution As Single
End Structureimport ctypes
from ctypes import wintypes
class PROPERTY_METRICS(ctypes.Structure):
_fields_ = [
("nLogicalMin", ctypes.c_int),
("nLogicalMax", ctypes.c_int),
("Units", ctypes.c_int),
("fResolution", ctypes.c_float),
]#[repr(C)]
pub struct PROPERTY_METRICS {
pub nLogicalMin: i32,
pub nLogicalMax: i32,
pub Units: i32,
pub fResolution: f32,
}import "golang.org/x/sys/windows"
type PROPERTY_METRICS struct {
nLogicalMin int32
nLogicalMax int32
Units int32
fResolution float32
}type
PROPERTY_METRICS = record
nLogicalMin: Integer;
nLogicalMax: Integer;
Units: Integer;
fResolution: Single;
end;const PROPERTY_METRICS = extern struct {
nLogicalMin: i32,
nLogicalMax: i32,
Units: i32,
fResolution: f32,
};type
PROPERTY_METRICS {.bycopy.} = object
nLogicalMin: int32
nLogicalMax: int32
Units: int32
fResolution: float32struct PROPERTY_METRICS
{
int nLogicalMin;
int nLogicalMax;
int Units;
float fResolution;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PROPERTY_METRICS サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; nLogicalMin : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; nLogicalMax : INT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Units : PROPERTY_UNITS (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; fResolution : FLOAT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PROPERTY_METRICS
#field int nLogicalMin
#field int nLogicalMax
#field int Units
#field float fResolution
#endstruct
stdim st, PROPERTY_METRICS ; NSTRUCT 変数を確保
st->nLogicalMin = 100
mes "nLogicalMin=" + st->nLogicalMin