ホーム › Graphics.Gdi › PolyPolyline
PolyPolyline
関数複数の連結折れ線をまとめて描画する。
シグネチャ
// GDI32.dll
#include <windows.h>
BOOL PolyPolyline(
HDC hdc,
const POINT* apt,
const DWORD* asz,
DWORD csz
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdc | HDC | in |
| apt | POINT* | in |
| asz | DWORD* | in |
| csz | DWORD | in |
戻り値の型: BOOL
各言語での呼び出し定義
// GDI32.dll
#include <windows.h>
BOOL PolyPolyline(
HDC hdc,
const POINT* apt,
const DWORD* asz,
DWORD csz
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern bool PolyPolyline(
IntPtr hdc, // HDC
IntPtr apt, // POINT*
ref uint asz, // DWORD*
uint csz // DWORD
);<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function PolyPolyline(
hdc As IntPtr, ' HDC
apt As IntPtr, ' POINT*
ByRef asz As UInteger, ' DWORD*
csz As UInteger ' DWORD
) As Boolean
End Function' hdc : HDC
' apt : POINT*
' asz : DWORD*
' csz : DWORD
Declare PtrSafe Function PolyPolyline Lib "gdi32" ( _
ByVal hdc As LongPtr, _
ByVal apt As LongPtr, _
ByRef asz As Long, _
ByVal csz As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PolyPolyline = ctypes.windll.gdi32.PolyPolyline
PolyPolyline.restype = wintypes.BOOL
PolyPolyline.argtypes = [
wintypes.HANDLE, # hdc : HDC
ctypes.c_void_p, # apt : POINT*
ctypes.POINTER(wintypes.DWORD), # asz : DWORD*
wintypes.DWORD, # csz : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
PolyPolyline = Fiddle::Function.new(
lib['PolyPolyline'],
[
Fiddle::TYPE_VOIDP, # hdc : HDC
Fiddle::TYPE_VOIDP, # apt : POINT*
Fiddle::TYPE_VOIDP, # asz : DWORD*
-Fiddle::TYPE_INT, # csz : DWORD
],
Fiddle::TYPE_INT)#[link(name = "gdi32")]
extern "system" {
fn PolyPolyline(
hdc: *mut core::ffi::c_void, // HDC
apt: *const POINT, // POINT*
asz: *const u32, // DWORD*
csz: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll")]
public static extern bool PolyPolyline(IntPtr hdc, IntPtr apt, ref uint asz, uint csz);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_PolyPolyline' -Namespace Win32 -PassThru
# $api::PolyPolyline(hdc, apt, asz, csz)#uselib "GDI32.dll"
#func global PolyPolyline "PolyPolyline" sptr, sptr, sptr, sptr
; PolyPolyline hdc, varptr(apt), varptr(asz), csz ; 戻り値は stat
; hdc : HDC -> "sptr"
; apt : POINT* -> "sptr"
; asz : DWORD* -> "sptr"
; csz : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "GDI32.dll" #cfunc global PolyPolyline "PolyPolyline" sptr, var, var, int ; res = PolyPolyline(hdc, apt, asz, csz) ; hdc : HDC -> "sptr" ; apt : POINT* -> "var" ; asz : DWORD* -> "var" ; csz : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "GDI32.dll" #cfunc global PolyPolyline "PolyPolyline" sptr, sptr, sptr, int ; res = PolyPolyline(hdc, varptr(apt), varptr(asz), csz) ; hdc : HDC -> "sptr" ; apt : POINT* -> "sptr" ; asz : DWORD* -> "sptr" ; csz : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL PolyPolyline(HDC hdc, POINT* apt, DWORD* asz, DWORD csz) #uselib "GDI32.dll" #cfunc global PolyPolyline "PolyPolyline" intptr, var, var, int ; res = PolyPolyline(hdc, apt, asz, csz) ; hdc : HDC -> "intptr" ; apt : POINT* -> "var" ; asz : DWORD* -> "var" ; csz : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL PolyPolyline(HDC hdc, POINT* apt, DWORD* asz, DWORD csz) #uselib "GDI32.dll" #cfunc global PolyPolyline "PolyPolyline" intptr, intptr, intptr, int ; res = PolyPolyline(hdc, varptr(apt), varptr(asz), csz) ; hdc : HDC -> "intptr" ; apt : POINT* -> "intptr" ; asz : DWORD* -> "intptr" ; csz : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procPolyPolyline = gdi32.NewProc("PolyPolyline")
)
// hdc (HDC), apt (POINT*), asz (DWORD*), csz (DWORD)
r1, _, err := procPolyPolyline.Call(
uintptr(hdc),
uintptr(apt),
uintptr(asz),
uintptr(csz),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction PolyPolyline(
hdc: THandle; // HDC
apt: Pointer; // POINT*
asz: Pointer; // DWORD*
csz: DWORD // DWORD
): BOOL; stdcall;
external 'GDI32.dll' name 'PolyPolyline';result := DllCall("GDI32\PolyPolyline"
, "Ptr", hdc ; HDC
, "Ptr", apt ; POINT*
, "Ptr", asz ; DWORD*
, "UInt", csz ; DWORD
, "Int") ; return: BOOL●PolyPolyline(hdc, apt, asz, csz) = DLL("GDI32.dll", "bool PolyPolyline(void*, void*, void*, dword)")
# 呼び出し: PolyPolyline(hdc, apt, asz, csz)
# hdc : HDC -> "void*"
# apt : POINT* -> "void*"
# asz : DWORD* -> "void*"
# csz : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。