Win32 API 日本語リファレンス
ホームGraphics.GdiPlus › GdipSetStringFormatTabStops

GdipSetStringFormatTabStops

関数
文字列書式のタブストップ位置を設定する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

// gdiplus.dll
#include <windows.h>

Status GdipSetStringFormatTabStops(
    GpStringFormat* format,
    FLOAT firstTabOffset,
    INT count,
    const FLOAT* tabStops
);

パラメーター

名前方向説明
formatGpStringFormat*inout設定対象のGpStringFormatオブジェクトへのポインタ。
firstTabOffsetFLOATin行頭から最初のタブ位置までのオフセットを示すFLOAT値。
countINTintabStops配列の要素数(タブストップ数)を示すINT値。
tabStopsFLOAT*in各タブストップ間の距離を示すFLOAT配列へのポインタ。

戻り値の型: Status

各言語での呼び出し定義

// gdiplus.dll
#include <windows.h>

Status GdipSetStringFormatTabStops(
    GpStringFormat* format,
    FLOAT firstTabOffset,
    INT count,
    const FLOAT* tabStops
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipSetStringFormatTabStops(
    IntPtr format,   // GpStringFormat* in/out
    float firstTabOffset,   // FLOAT
    int count,   // INT
    ref float tabStops   // FLOAT*
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipSetStringFormatTabStops(
    format As IntPtr,   ' GpStringFormat* in/out
    firstTabOffset As Single,   ' FLOAT
    count As Integer,   ' INT
    ByRef tabStops As Single   ' FLOAT*
) As Integer
End Function
' format : GpStringFormat* in/out
' firstTabOffset : FLOAT
' count : INT
' tabStops : FLOAT*
Declare PtrSafe Function GdipSetStringFormatTabStops Lib "gdiplus" ( _
    ByVal format As LongPtr, _
    ByVal firstTabOffset As Single, _
    ByVal count As Long, _
    ByRef tabStops As Single) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipSetStringFormatTabStops = ctypes.windll.gdiplus.GdipSetStringFormatTabStops
GdipSetStringFormatTabStops.restype = ctypes.c_int
GdipSetStringFormatTabStops.argtypes = [
    ctypes.c_void_p,  # format : GpStringFormat* in/out
    ctypes.c_float,  # firstTabOffset : FLOAT
    ctypes.c_int,  # count : INT
    ctypes.POINTER(ctypes.c_float),  # tabStops : FLOAT*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('gdiplus.dll')
GdipSetStringFormatTabStops = Fiddle::Function.new(
  lib['GdipSetStringFormatTabStops'],
  [
    Fiddle::TYPE_VOIDP,  # format : GpStringFormat* in/out
    Fiddle::TYPE_FLOAT,  # firstTabOffset : FLOAT
    Fiddle::TYPE_INT,  # count : INT
    Fiddle::TYPE_VOIDP,  # tabStops : FLOAT*
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdiplus")]
extern "system" {
    fn GdipSetStringFormatTabStops(
        format: *mut GpStringFormat,  // GpStringFormat* in/out
        firstTabOffset: f32,  // FLOAT
        count: i32,  // INT
        tabStops: *const f32  // FLOAT*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipSetStringFormatTabStops(IntPtr format, float firstTabOffset, int count, ref float tabStops);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipSetStringFormatTabStops' -Namespace Win32 -PassThru
# $api::GdipSetStringFormatTabStops(format, firstTabOffset, count, tabStops)
#uselib "gdiplus.dll"
#func global GdipSetStringFormatTabStops "GdipSetStringFormatTabStops" sptr, float, sptr, sptr
; GdipSetStringFormatTabStops varptr(format), firstTabOffset, count, varptr(tabStops)   ; 戻り値は stat
; format : GpStringFormat* in/out -> "sptr"
; firstTabOffset : FLOAT -> "float"
; count : INT -> "sptr"
; tabStops : FLOAT* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "gdiplus.dll"
#cfunc global GdipSetStringFormatTabStops "GdipSetStringFormatTabStops" var, float, int, var
; res = GdipSetStringFormatTabStops(format, firstTabOffset, count, tabStops)
; format : GpStringFormat* in/out -> "var"
; firstTabOffset : FLOAT -> "float"
; count : INT -> "int"
; tabStops : FLOAT* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; Status GdipSetStringFormatTabStops(GpStringFormat* format, FLOAT firstTabOffset, INT count, FLOAT* tabStops)
#uselib "gdiplus.dll"
#cfunc global GdipSetStringFormatTabStops "GdipSetStringFormatTabStops" var, float, int, var
; res = GdipSetStringFormatTabStops(format, firstTabOffset, count, tabStops)
; format : GpStringFormat* in/out -> "var"
; firstTabOffset : FLOAT -> "float"
; count : INT -> "int"
; tabStops : FLOAT* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"math"
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipSetStringFormatTabStops = gdiplus.NewProc("GdipSetStringFormatTabStops")
)

// format (GpStringFormat* in/out), firstTabOffset (FLOAT), count (INT), tabStops (FLOAT*)
r1, _, err := procGdipSetStringFormatTabStops.Call(
	uintptr(format),
	uintptr(math.Float32bits(firstTabOffset)),
	uintptr(count),
	uintptr(tabStops),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // Status
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。
function GdipSetStringFormatTabStops(
  format: Pointer;   // GpStringFormat* in/out
  firstTabOffset: Single;   // FLOAT
  count: Integer;   // INT
  tabStops: Pointer   // FLOAT*
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipSetStringFormatTabStops';
result := DllCall("gdiplus\GdipSetStringFormatTabStops"
    , "Ptr", format   ; GpStringFormat* in/out
    , "Float", firstTabOffset   ; FLOAT
    , "Int", count   ; INT
    , "Ptr", tabStops   ; FLOAT*
    , "Int")   ; return: Status
●GdipSetStringFormatTabStops(format, firstTabOffset, count, tabStops) = DLL("gdiplus.dll", "int GdipSetStringFormatTabStops(void*, float, int, void*)")
# 呼び出し: GdipSetStringFormatTabStops(format, firstTabOffset, count, tabStops)
# format : GpStringFormat* in/out -> "void*"
# firstTabOffset : FLOAT -> "float"
# count : INT -> "int"
# tabStops : FLOAT* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "gdiplus" fn GdipSetStringFormatTabStops(
    format: [*c]GpStringFormat, // GpStringFormat* in/out
    firstTabOffset: f32, // FLOAT
    count: i32, // INT
    tabStops: [*c]f32 // FLOAT*
) callconv(std.os.windows.WINAPI) i32;
proc GdipSetStringFormatTabStops(
    format: ptr GpStringFormat,  # GpStringFormat* in/out
    firstTabOffset: float32,  # FLOAT
    count: int32,  # INT
    tabStops: ptr float32  # FLOAT*
): int32 {.importc: "GdipSetStringFormatTabStops", stdcall, dynlib: "gdiplus.dll".}
pragma(lib, "gdiplus");
extern(Windows)
int GdipSetStringFormatTabStops(
    GpStringFormat* format,   // GpStringFormat* in/out
    float firstTabOffset,   // FLOAT
    int count,   // INT
    float* tabStops   // FLOAT*
);
ccall((:GdipSetStringFormatTabStops, "gdiplus.dll"), stdcall, Int32,
      (Ptr{GpStringFormat}, Float32, Int32, Ptr{Float32}),
      format, firstTabOffset, count, tabStops)
# format : GpStringFormat* in/out -> Ptr{GpStringFormat}
# firstTabOffset : FLOAT -> Float32
# count : INT -> Int32
# tabStops : FLOAT* -> Ptr{Float32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t GdipSetStringFormatTabStops(
    void* format,
    float firstTabOffset,
    int32_t count,
    float* tabStops);
]]
local gdiplus = ffi.load("gdiplus")
-- gdiplus.GdipSetStringFormatTabStops(format, firstTabOffset, count, tabStops)
-- format : GpStringFormat* in/out
-- firstTabOffset : FLOAT
-- count : INT
-- tabStops : FLOAT*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipSetStringFormatTabStops = lib.func('__stdcall', 'GdipSetStringFormatTabStops', 'int32_t', ['void *', 'float', 'int32_t', 'float *']);
// GdipSetStringFormatTabStops(format, firstTabOffset, count, tabStops)
// format : GpStringFormat* in/out -> 'void *'
// firstTabOffset : FLOAT -> 'float'
// count : INT -> 'int32_t'
// tabStops : FLOAT* -> 'float *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("gdiplus.dll", {
  GdipSetStringFormatTabStops: { parameters: ["pointer", "f32", "i32", "pointer"], result: "i32" },
});
// lib.symbols.GdipSetStringFormatTabStops(format, firstTabOffset, count, tabStops)
// format : GpStringFormat* in/out -> "pointer"
// firstTabOffset : FLOAT -> "f32"
// count : INT -> "i32"
// tabStops : FLOAT* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t GdipSetStringFormatTabStops(
    void* format,
    float firstTabOffset,
    int32_t count,
    float* tabStops);
C, "gdiplus.dll");
// $ffi->GdipSetStringFormatTabStops(format, firstTabOffset, count, tabStops);
// format : GpStringFormat* in/out
// firstTabOffset : FLOAT
// count : INT
// tabStops : FLOAT*
// 構造体/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 Gdiplus extends StdCallLibrary {
    Gdiplus INSTANCE = Native.load("gdiplus", Gdiplus.class);
    int GdipSetStringFormatTabStops(
        Pointer format,   // GpStringFormat* in/out
        float firstTabOffset,   // FLOAT
        int count,   // INT
        FloatByReference tabStops   // FLOAT*
    );
}
@[Link("gdiplus")]
lib Libgdiplus
  fun GdipSetStringFormatTabStops = GdipSetStringFormatTabStops(
    format : GpStringFormat*,   # GpStringFormat* in/out
    firstTabOffset : Float32,   # FLOAT
    count : Int32,   # INT
    tabStops : Float32*   # FLOAT*
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef GdipSetStringFormatTabStopsNative = Int32 Function(Pointer<Void>, Float, Int32, Pointer<Float>);
typedef GdipSetStringFormatTabStopsDart = int Function(Pointer<Void>, double, int, Pointer<Float>);
final GdipSetStringFormatTabStops = DynamicLibrary.open('gdiplus.dll')
    .lookupFunction<GdipSetStringFormatTabStopsNative, GdipSetStringFormatTabStopsDart>('GdipSetStringFormatTabStops');
// format : GpStringFormat* in/out -> Pointer<Void>
// firstTabOffset : FLOAT -> Float
// count : INT -> Int32
// tabStops : FLOAT* -> Pointer<Float>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function GdipSetStringFormatTabStops(
  format: Pointer;   // GpStringFormat* in/out
  firstTabOffset: Single;   // FLOAT
  count: Integer;   // INT
  tabStops: Pointer   // FLOAT*
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipSetStringFormatTabStops';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "GdipSetStringFormatTabStops"
  c_GdipSetStringFormatTabStops :: Ptr () -> CFloat -> Int32 -> Ptr CFloat -> IO Int32
-- format : GpStringFormat* in/out -> Ptr ()
-- firstTabOffset : FLOAT -> CFloat
-- count : INT -> Int32
-- tabStops : FLOAT* -> Ptr CFloat
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let gdipsetstringformattabstops =
  foreign "GdipSetStringFormatTabStops"
    ((ptr void) @-> float @-> int32_t @-> (ptr float) @-> returning int32_t)
(* format : GpStringFormat* in/out -> (ptr void) *)
(* firstTabOffset : FLOAT -> float *)
(* count : INT -> int32_t *)
(* tabStops : FLOAT* -> (ptr float) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library gdiplus (t "gdiplus.dll"))
(cffi:use-foreign-library gdiplus)

(cffi:defcfun ("GdipSetStringFormatTabStops" gdip-set-string-format-tab-stops :convention :stdcall) :int32
  (format :pointer)   ; GpStringFormat* in/out
  (first-tab-offset :float)   ; FLOAT
  (count :int32)   ; INT
  (tab-stops :pointer))   ; FLOAT*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $GdipSetStringFormatTabStops = Win32::API::More->new('gdiplus',
    'int GdipSetStringFormatTabStops(LPVOID format, float firstTabOffset, int count, LPVOID tabStops)');
# my $ret = $GdipSetStringFormatTabStops->Call($format, $firstTabOffset, $count, $tabStops);
# format : GpStringFormat* in/out -> LPVOID
# firstTabOffset : FLOAT -> float
# count : INT -> int
# tabStops : FLOAT* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型