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